Passenger (and other forking servers like Puma) starts the app in one process, which opens the SQLite database, and then forks it for new workers, which inherits the same database, which gets closed for safety, and you get an error.
Passenger apparently handles this automatically by itself for ActiveRecord databases, but not for raw SQLite gem connections like this one.
Workaround for now for Passenger is to add this to the site configuration in Nginx:
passenger_spawn_method direct;
https://www.phusionpassenger.com/docs/advanced_guides/in_depth/ruby/spawn_methods.html
https://github.com/sparklemotion/sqlite3-ruby/blob/main/adr/2024-09-fork-safety.md
Should be fixed in cf27de4d6bfda6bf8f952689bab930959cfd9ea6.