SQLite Forum

SQLite in-memory database encounters SQLITE_LOCKED_SHAREDCACHE intermittently
No, that is not the cause of the problem.  A trigger simply causes additional things to sometimes (conditionally) be done with a connection, inside of an active transaction.

What you have not mentioned in your post(s) is any reason to believe or disbelieve that more than one connection is being held on the DB or more than one thread is using the one known connection.  Since these possibilities are part of the most likely cause of your problem, they should be resolved before other conjectures are explored. The error code/message is informing you that the instigating DB activity could not proceed because the attempt lost in the contention for an exclusive resource. The question then is "What other activity won in that contention?"