MemPalace/mempalace · error · RuntimeError
_paginate_ids: both offset-based pagination and the no-offse
Error message
_paginate_ids: both offset-based pagination and the no-offset fallback failed after collecting {len(ids)} ids. Refusing to return a silently truncated ID list -- investigate the collection, or use a repair mode that does not depend on offset paging (e.g. --mode from-sqlite). Underlying error: {fallback_exc} What it means
Error "_paginate_ids: both offset-based pagination and the no-offset fallback failed after collecting {len(ids)} ids. Refusing to return a silently truncated ID list -- investigate the collection, or use a repair mode that does not depend on offset paging (e.g. --mode from-sqlite). Underlying error: {fallback_exc}" thrown in MemPalace/mempalace.
Source
Thrown at mempalace/repair.py:218
ids = []
page = 1000
offset = 0
while True:
try:
r = col.get(where=where, include=[], limit=page, offset=offset)
except Exception:
try:
r = col.get(where=where, include=[], limit=page)
except Exception as fallback_exc:
# Both the offset request AND the no-offset fallback failed.
# Whatever is in ``ids`` so far is a partial (or empty) prefix
# of the collection, not a complete listing. Returning it
# would make scan_palace/rebuild act on a truncated palace as
# though it were whole (or, on the first page, print "Nothing
# to scan." for a palace we never actually read). The whole
# point of this path is to fail loudly rather than silently
# truncate, so raise instead of breaking.
raise RuntimeError(
f"_paginate_ids: both offset-based pagination and the "
f"no-offset fallback failed after collecting {len(ids)} "
f"ids. Refusing to return a silently truncated ID list -- "
f"investigate the collection, or use a repair mode that "
f"does not depend on offset paging (e.g. --mode "
f"from-sqlite). Underlying error: {fallback_exc}"
) from fallback_exc
new_ids = [i for i in r["ids"] if i not in set(ids)]
if not new_ids:
# Offset is broken and the no-offset fallback always
# re-fetches the same first `page` results, so it can never
# advance past that boundary. Landing exactly on that
# boundary (len(ids) >= page) is ambiguous from the fetched
# page alone: it could mean "collection has exactly `page`
# ids, genuinely complete" or "collection has more and we
# are truncating" -- those two states are indistinguishable
# without an authoritative count. Disambiguate against the
# collection's own count() (same pattern already used byView on GitHub (pinned to 06cb6987f0)
Solutions
- Investigate the collection, or use a repair mode that does not depend on offset paging (e.g. --mode from-sqlite)
When it happens
Trigger: Thrown at mempalace/repair.py:218 when the library encounters an invalid state.
Common situations: Both offset pagination and the no-offset fallback failed; returning would silently truncate the id list.
AI-assisted analysis of MemPalace/mempalace@06cb6987f0 (2026-08-15).
Data as JSON: /api/errors/2289988f3e8281c2.
Report an issue: GitHub.