Skip to content

Troubleshooting

Gustav Grusell edited this page Dec 12, 2025 · 1 revision

Troubleshooting.md

Entity instance must not be null

In some circumstances, the encore db may end up in an inconsistent state. When this happens, any calls to the list job endpoint /encoreJobs will fail with a message Entity instance must not be null. This is caused by a bug in spring data redis, see https://github.com/spring-projects/spring-data-redis/issues/1145#issuecomment-2685265173 .

If this happens, the problem can be solved by removing obsolete index entries in the database by running the below script. The script iterate through the index stored in encore-jobs and verifies that the corresponding job still exists. If not, the index entry is removed.

#!/bin/bash
rediscli=redis.cli

while getopts "c:n:" arg
do
    case $arg in
        c)
            rediscli="$OPTARG"
            ;;
        
        *)
            ;;
    esac
done

shift $((OPTIND-1))

echo $rediscli
for id in $($rediscli -c smembers encore-jobs | cut -d' ' -f2)
do
    exists=$($rediscli -c EXISTS encore-jobs:${id})
    echo "${id}: ${exists}"
    if [[ $exists == "0" ]]
    then
        echo "removing"
        $rediscli srem encore-jobs ${id}
    fi
done

Clone this wiki locally