{"record":{"id":"7e2149b4ab162df2","repo":"zylon-ai/private-gpt","slug":"local-path-is-required-for-sqlite-client","errorCode":null,"errorMessage":"local_path is required for sqlite client","messagePattern":"local_path is required for sqlite client","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"private_gpt/components/persistence/persistence_component.py","lineNumber":46,"sourceCode":"        if store in self._clients:\n            return self._clients[store]\n\n        client: Any | None = None\n        match store:\n            case \"postgres\":\n                from private_gpt.components.postgres.postgres_client import (\n                    LazyPostgresFactory,\n                )\n\n                client = LazyPostgresFactory.get_instance(self._settings)\n            case \"sqlite\":\n                from private_gpt.components.sqlite.sqlite_client import (\n                    LazySQLiteFactory,\n                )\n\n                local_path = self._settings.database.local_path\n                if local_path is None:\n                    raise ValueError(\"local_path is required for sqlite client\")\n                client = LazySQLiteFactory.get_instance(self._settings)\n\n        self._clients[store] = client\n        return client\n\n    def _get_migration_backend(\n        self,\n        store: str,\n        client: Any,\n    ) -> MigrationBackend:\n        match store:\n            case \"postgres\" | \"sqlite\":\n                from private_gpt.components.migrations.backend.sqlalchemy_backend import (\n                    SQLAlchemyMigrationBackend,\n                )\n\n                engine = client.sync_session.kw.get(\"bind\")\n                if engine is None:","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/persistence/persistence_component.py#L28-L64","documentation":"In `PersistenceComponent.get_client`, the 'sqlite' branch reads `settings.database.local_path` and raises `ValueError` when it is None before constructing the lazy SQLite factory. SQLite persistence requires an on-disk database file location; the settings schema allows it to be unset, and this is the startup-time enforcement.","triggerScenarios":"Setting `database.provider: sqlite` (or defaulting to it) without setting `database.local_path`; env-specific settings files that omit the path; running the persistence/migration component init which calls `get_client('sqlite')`.","commonSituations":"Fresh local setup copying a template settings file that lacks `local_path`; switching from postgres to sqlite provider without adding the path; container deployments forgetting to mount/configure the db path.","solutions":["Set `database.local_path` in settings (e.g. `/data/app.db` or `./local.db`) to a writable location","Ensure the path's parent directory exists and the process has write permission","In containers, back the path with a volume if persistence across restarts is needed"],"exampleFix":"# before\ndatabase:\n  provider: sqlite\n  # local_path missing -> ValueError\n\n# after\ndatabase:\n  provider: sqlite\n  local_path: /var/lib/privategpt/app.db","handlingStrategy":"validation","validationCode":"if settings.database.provider == \"sqlite\" and not settings.database.local_path:\n    raise ValueError(\"database.local_path must be set when provider is sqlite\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate provider/local_path pairs in a settings schema check at startup","Add a settings example file with local_path filled in for sqlite"],"tags":["configuration","sqlite","persistence","startup"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}