Raise Neo4jError.hydrate(**metadata)\nneo4j.exceptions.CypherTypeError: Can't coerce `NO_VALUE` to List"

Python Driver: 4.0.0
NEO4J Version: 4.0.5 Enterprise running in an AWS EC2 VM

When I run this query:

call{
                MATCH (u:User {user_id:$owner_id})
                OPTIONAL MATCH (u)-[:USER]-(mf:Image)
                with u, collect(mf.version_history) as myInts
                WITH u, REDUCE(output = [], i IN myInts| output + i) AS my_files
                MATCH (u)-[:FAMILY_FRIEND]-(:User)-[ul:USER]-(f:Image)
                with collect({node: f, deleted: exists(ul.deleted), vh: f.version_history, vd: f.version_date}) as files, my_files
                unwind files as fset
                with fset['node'] as f, fset['deleted'] as deleted, fset['vh'] as vh, fset['vd'] as vd, files, my_files
                WHERE none(x in files WHERE apoc.coll.intersection(vh, x['vh']) and x['vd'] > vd)
                AND not apoc.coll.intersection(vh, my_files) AND not deleted
                return f
                union
                MATCH (:User {user_id:$owner_id})-[ul:USER]-(f:Image) 
                WHERE not exists(ul.deleted)
                return f
            }
            WITH f
            %s
            WITH f
            ORDER BY f.version_date DESC, f.uid DESC
            SKIP $skip
            LIMIT $limit
            WITH f
            OPTIONAL MATCH (f)-[rel:FACE|HAS_IMAGE|HAS_EVENT|UPLOADED_BY|WHEN]-(n)
            return f, rel, n

It works fine all the time with one owner_id and gives the traceback with a different owner id, but after several pages. Once it gets the error it continues to get the error for that user until the db server is restarted no matter what parameters you pass for the skip and limit, however it continues to work fine when you pass a different owner_id. To make matters more confusing, the query always works fine in the NEO4J desktop no matter what parameters you pass and even after it has failed running through the application in the Python code:

Traceback (most recent call last):
  File \"/var/task/chalice/app.py\", line 1112, in _get_view_function_response
    response = view_function(**function_args)
  File \"/var/task/app.py\", line 408, in photos
    photos = FileImage.get_all(user_id, person_id, location_id, page, event_id)
  File \"/var/task/chalicelib/files/photos.py\", line 453, in get_all
    g = result.graph()
  File \"/var/task/neo4j/work/result.py\", line 291, in graph
    self._buffer_all()
  File \"/var/task/neo4j/work/result.py\", line 208, in _buffer_all
    for record in self:
  File \"/var/task/neo4j/work/result.py\", line 184, in __iter__
    self._connection.fetch_message()  # Receive at least one message from the server, if available.
  File \"/var/task/neo4j/io/_bolt4x0.py\", line 330, in fetch_message
    response.on_failure(summary_metadata or {})
  File \"/var/task/neo4j/io/_bolt4x0.py\", line 518, in on_failure
    raise Neo4jError.hydrate(**metadata)\nneo4j.exceptions.CypherTypeError: Can't coerce `NO_VALUE` to List

Anyone have any idea about what could be causing this?