MemPalace/mempalace · error · PalaceNotFoundError
{palace_path}
Error message
{palace_path} What it means
`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.
Source
Thrown at mempalace/backends/sqlite_exact.py:1086
INSERT INTO meta(key, value)
VALUES ('fts5_available', '0')
ON CONFLICT(key) DO UPDATE SET value = excluded.value
"""
)
conn.commit()
def get_collection(
self,
*args,
**kwargs,
) -> SQLiteExactCollection:
palace, collection_name, create, read_only = self._normalize_args(args, kwargs)
self.require_namespace_support(palace)
palace_path = palace.local_path
if palace_path is None:
raise PalaceNotFoundError("SQLiteExactBackend requires PalaceRef.local_path")
if not create and not os.path.isdir(palace_path):
raise PalaceNotFoundError(palace_path)
handle = self._connect(palace_path, create=create, read_only=read_only)
with handle.lock:
row = handle.conn.execute(
"SELECT id FROM collections WHERE name = ?",
(collection_name,),
).fetchone()
if row is None:
if not create:
raise CollectionNotInitializedError(collection_name)
from ..palace import mine_palace_lock
with mine_palace_lock(palace_path):
handle.conn.execute(
"INSERT INTO collections(name, created_at) VALUES (?, ?)",
(collection_name, _utcnow()),
)
handle.conn.commit()
return SQLiteExactCollection(handle, collection_name)View on GitHub (pinned to 06cb6987f0)
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.
Example fix
# before
col = backend.get_collection(palace, "drawers") # dir missing, create=False
# after
if not Path(palace.local_path).is_dir():
col = backend.get_collection(palace, "drawers", create=True)
else:
col = backend.get_collection(palace, "drawers") Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
def palace_dir_ready(palace_path) -> bool:
return Path(palace_path).is_dir() Try / catch
try:
col = backend.get_collection(palace, name)
except PalaceNotFoundError as e:
if not Path(palace.local_path).is_dir():
col = backend.get_collection(palace, name, create=True) # bootstrap
else:
raise Prevention
- 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.
When it happens
Trigger: `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`.
Common situations: 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.
Related errors
- {db_path}
- {collection_name}
- {label} length {len(value)} does not match ids length {n}
- query requires exactly one of query_texts or query_embedding
- {marker_path}
AI-assisted analysis of MemPalace/mempalace@06cb6987f0 (2026-08-15).
Data as JSON: /api/errors/36bf3259043b0e01.
Report an issue: GitHub.