Type casting between storable and virtual

Run this to get a list of all internal Ids for all nodes with label itemA:
match(a:itemA) with collect(id(a)) as IdList merge (c:cache) set c.IdList = IdList

Then run this to try and retrieve all nodes with label itemA, whose internal Id is in the list you previously stored:
match (c:cache) with c.IdList as IdList match (a:itemA) where id(a) in IdList return count(a)

Observe Neo explode because it can't convert org.neo4j.values.storable.LongArray (the array you stored in the node with label cache) to org.neo4j.values.virtual.ListValue (the list in memory). Both of these lists were generated using the Id() function. Any ideas how to resolve this error? Do we need to run a cast somewhere?