Cannot get primary key value: entity is null

Lately I’m seeing in the tomcat log that the following error is generated

09:25:37.096 ERROR o.s.t.s.TransactionSynchronizationUtils - TransactionSynchronization.afterCompletion threw exception
java.lang.IllegalStateException: Cannot get primary key value: entity is null
        at com.haulmont.cuba.core.entity.IdProxy.getNN( ~[cuba-global-6.9.0.jar:6.9.0]
        at com.haulmont.cuba.core.entity.FtsQueue.setObjectEntityId( ~[cuba-global-6.9.0.jar:6.9.0]
        at ~[fts-core-6.9.0.jar:6.9.0]
        at ~[fts-core-6.9.0.jar:6.9.0]
        at$enqueue$0( ~[fts-core-6.9.0.jar:6.9.0]
        at com.haulmont.cuba.core.sys.PersistenceImpl$EntityManagerContextSynchronization.afterCompletion( ~[cuba-core-6.9.0.jar:6.9.0]

The only thing I notice is that you have a service that makes a notification by email, the notification is done without problem but always generates the error.

Is it something that has to do with my code?

protected boolean postCommit(boolean committed, boolean close) {
    if (committed && wasNew) {
    return super.postCommit(committed, close);


The problem is fixed in the platform version 6.9.1. Issue: FTS does not work for identity entities · Issue #27 · cuba-platform/fts · GitHub