MemPalace/mempalace · error · ValueError

{field} must be a non-empty string

Error message

{field} must be a non-empty string

What it means

Error "{field} must be a non-empty string" thrown in MemPalace/mempalace.

Source

Thrown at mempalace/palace_graph.py:460

    source_wing: str, source_room: str, target_wing: str, target_room: str
) -> str:
    """Compute a symmetric tunnel ID.

    Tunnels are conceptually undirected — "auth relates to users" is the
    same connection as "users relates to auth". Sort the two endpoints
    before hashing so ``create_tunnel(A, B)`` and ``create_tunnel(B, A)``
    resolve to the same ID and dedup into one record.
    """
    src = _endpoint_key(source_wing, source_room)
    tgt = _endpoint_key(target_wing, target_room)
    a, b = sorted((src, tgt))
    return hashlib.sha256(f"{a}↔{b}".encode()).hexdigest()[:16]


def _require_name(value: str, field: str) -> str:
    """Reject empty / non-string endpoint identifiers."""
    if not isinstance(value, str) or not value.strip():
        raise ValueError(f"{field} must be a non-empty string")
    return value.strip()


def _check_room_exists(wing: str, room: str, col) -> bool:
    """Check if at least one drawer exists for the given wing/room in ChromaDB."""
    if col is None:
        # If collection is unreachable, can't verify, so allow.
        logger.debug(
            "ChromaDB collection not reachable, skipping room existence validation for %s/%s",
            wing,
            room,
        )
        return True
    try:
        results = col.get(where={"$and": [{"wing": wing}, {"room": room}]}, limit=1, include=[])
        return len(results["ids"]) > 0
    except Exception:
        # If query fails, assume it's a temporary issue or permissions, and allow.

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Pass a non-empty string for the field

When it happens

Trigger: Thrown at mempalace/palace_graph.py:460 when the library encounters an invalid state.

Common situations: Required wing/room name argument was empty or not a string.


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