NullPointerException: target is null for method size

I have a TaskListener that creates an attachment on the Task on event="complete"
When I try to query the Task in flowable-task webapp, I get this exception:

10:15:57,225 [qtp1112280004-13] ERROR org.flowable.engine.common.impl.interceptor.CommandContext - Error while closing command context
org.apache.ibatis.exceptions.PersistenceException:

Error querying database. Cause: java.lang.NullPointerException: target is null for method size

Cause: java.lang.NullPointerException: target is null for method size

at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)


Caused by: java.lang.NullPointerException: target is null for method size
at org.apache.ibatis.ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1611)
at org.apache.ibatis.ognl.ASTMethod.getValueBody(ASTMethod.java:91)
at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)

What could be wrong?

Any updates on this?