Google AI fails with 500 internal error: The database is read only
Problem
The analysis of assets with the Google AI integration fail with an 500 internal server error. This error can appear in the web client’s pop-up notifications and in the application logs:
2025.07.02-13:59:00.475 INFO : T080: CommandExecutor: master.20250702.135900.406[censhare]: google_vision.update-data-action
com.censhare.support.util.DetailException: The following assets could not be processed: 67453 (status code: 500, reason phrase: 500: PreparedStatementCallback
nested exception is org.h2.jdbc.JdbcSQLNonTransientException: The database is read only; SQL statement:
The same error will appear in the Google AI’s service logs:
Jul 2 13:59:00 censhare-server google-ai[61219]: 2025-07-02 13:59:00.426 ERROR 61219 --- [nio-8033-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [...]; SQL state [90097]; error code [90097]; The database is read only; SQL statement:
Jul 2 13:59:00 censhare-server google-ai[61219]: INSERT INTO ProcessingRequest (...) VALUES(...) [90097-200]; nested exception is org.h2.jdbc.JdbcSQLNonTransientException: The database is read only; SQL statement:
Solution
The cause of the problem is wrong owner and permissions in the /opt/censer/google-ai/ directory, where the service is installed; specifically, the requestdb.mv.db requestdb.trace.db inside the db sub-directory. To resolve the issue, change the permissions so that censer and corpus users can write to the files and the /db/ sub-directory:
[root@censhare-server db]# ls -lah
total 28K
-rw-r--r-- 1 censer corpus 24K Jul 2 15:32 requestdb.mv.db
-rw-r--r-- 1 censer corpus 1.7K Jul 2 14:08 requestdb.trace.db
Not all the files inside /opt/censer/google-ai/ require writing permissions during runtime. The /db/ sub-directory and its files do since they are used for keeping track of the requests sent through the service.