MemPalace/mempalace · error · ValueError

source_file exceeds maximum length of {_MAX_SOURCE_FILE_LENG

Error message

source_file exceeds maximum length of {_MAX_SOURCE_FILE_LENGTH} characters

What it means

Error "source_file exceeds maximum length of {_MAX_SOURCE_FILE_LENGTH} characters" thrown in MemPalace/mempalace.

Source

Thrown at mempalace/mcp_server.py:1821

    ChromaDB metadata-equality / parameterized-SQL value — never used as a
    filesystem path — so there is no traversal risk to guard against. A null
    byte or a pathological length can still upset the backend (chromadb
    add/upsert chokes on null bytes / lone surrogates, #1235), so guard those
    for parity with ``sanitize_name``. Blank / whitespace-only is "no filter".
    """
    if value is None:
        return None
    if not isinstance(value, str):
        raise ValueError("source_file must be a string")
    value = value.strip()
    if not value:
        return None
    if "\x00" in value:
        raise ValueError("source_file contains null bytes")
    if value != strip_lone_surrogates(value):
        raise ValueError("source_file contains invalid surrogate characters")
    if len(value) > _MAX_SOURCE_FILE_LENGTH:
        raise ValueError(
            f"source_file exceeds maximum length of {_MAX_SOURCE_FILE_LENGTH} characters"
        )
    return value


# The #1128 date-filter helpers moved to ``mempalace.date_window`` so the
# search-side window (#463) can share them without importing this module
# (whose import installs MCP stdio protection). Aliased under their
# historical private names — every call site and test keeps working.
_parse_date_filter = parse_date_bound
_filed_at_in_window = filed_at_in_window


# ==================== READ TOOLS ====================


def _tool_status_via_sqlite() -> dict:
    """Pure-sqlite status reader for the #1222 fallback path.

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Shorten the source_file path below the maximum length

When it happens

Trigger: Thrown at mempalace/mcp_server.py:1821 when the library encounters an invalid state.

Common situations: An excessively long source_file path was submitted.


AI-assisted analysis of MemPalace/mempalace@06cb6987f0 (2026-08-15). Data as JSON: /api/errors/b5a6b542b51ae84b. Report an issue: GitHub.