{"record":{"id":"36bf3259043b0e01","repo":"MemPalace/mempalace","slug":"palace-path-36bf32","errorCode":null,"errorMessage":"{palace_path}","messagePattern":"\\{palace_path\\}","errorType":"exception","errorClass":"PalaceNotFoundError","httpStatus":null,"severity":"error","filePath":"mempalace/backends/sqlite_exact.py","lineNumber":1086,"sourceCode":"                INSERT INTO meta(key, value)\n                VALUES ('fts5_available', '0')\n                ON CONFLICT(key) DO UPDATE SET value = excluded.value\n                \"\"\"\n            )\n        conn.commit()\n\n    def get_collection(\n        self,\n        *args,\n        **kwargs,\n    ) -> SQLiteExactCollection:\n        palace, collection_name, create, read_only = self._normalize_args(args, kwargs)\n        self.require_namespace_support(palace)\n        palace_path = palace.local_path\n        if palace_path is None:\n            raise PalaceNotFoundError(\"SQLiteExactBackend requires PalaceRef.local_path\")\n        if not create and not os.path.isdir(palace_path):\n            raise PalaceNotFoundError(palace_path)\n        handle = self._connect(palace_path, create=create, read_only=read_only)\n        with handle.lock:\n            row = handle.conn.execute(\n                \"SELECT id FROM collections WHERE name = ?\",\n                (collection_name,),\n            ).fetchone()\n            if row is None:\n                if not create:\n                    raise CollectionNotInitializedError(collection_name)\n                from ..palace import mine_palace_lock\n\n                with mine_palace_lock(palace_path):\n                    handle.conn.execute(\n                        \"INSERT INTO collections(name, created_at) VALUES (?, ?)\",\n                        (collection_name, _utcnow()),\n                    )\n                    handle.conn.commit()\n        return SQLiteExactCollection(handle, collection_name)","sourceCodeStart":1068,"sourceCodeEnd":1104,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/backends/sqlite_exact.py#L1068-L1104","documentation":"`PalaceNotFoundError` whose message is the palace directory path, raised at the top of `SQLiteExactBackend.get_collection`. Before connecting, the backend checks the palace directory exists when `create=False`; a missing directory means the palace was never built at that path (or the path is wrong), so it fails fast with the offending path.","triggerScenarios":"`backend.get_collection(palace, name)` (create defaults to False) where `palace.local_path` points at a non-existent directory; also raised earlier with a fixed message when `local_path` is None. Distinct from error 174: this checks the directory, before the db-file check in `_connect`.","commonSituations":"Fresh machine/clone without the palace data; palace path from env var or config not set; renamed or moved palace; create flag accidentally omitted when bootstrapping a new palace.","solutions":["Confirm the directory exists: `os.path.isdir(palace.local_path)`; print the path you are actually passing.","Pass `create=True` when intentionally bootstrapping a new palace.","Resolve palace paths once from configuration into absolute paths; do not rely on cwd.","Catch PalaceNotFoundError to trigger onboarding/first-run setup."],"exampleFix":"# before\ncol = backend.get_collection(palace, \"drawers\")  # dir missing, create=False\n\n# after\nif not Path(palace.local_path).is_dir():\n    col = backend.get_collection(palace, \"drawers\", create=True)\nelse:\n    col = backend.get_collection(palace, \"drawers\")","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\ndef palace_dir_ready(palace_path) -> bool:\n    return Path(palace_path).is_dir()","typeGuard":null,"tryCatchPattern":"try:\n    col = backend.get_collection(palace, name)\nexcept PalaceNotFoundError as e:\n    if not Path(palace.local_path).is_dir():\n        col = backend.get_collection(palace, name, create=True)  # bootstrap\n    else:\n        raise","preventionTips":["Check `os.path.isdir(palace.local_path)` before non-create opens in diagnostics.","Ensure PalaceRef.local_path is always set — None raises a fixed PalaceNotFoundError message.","Use create=True only where creating is intended, to avoid masking path typos."],"tags":["sqlite-exact","palace-not-found","collection","path"],"backgroundTag":null,"analyzedSha":"06cb6987f02610784fefbad4b2bd5d026d164ba6","analyzedAt":"2026-08-15T03:03:36.213Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}