MemPalace/mempalace · error · OSError

Refusing non-regular file: {path}

Error message

Refusing non-regular file: {path}

What it means

Error "Refusing non-regular file: {path}" thrown in MemPalace/mempalace.

Source

Thrown at mempalace/sweeper.py:114

          "timestamp":  str,   # ISO 8601
          "role":       "user" | "assistant",
          "content":    str,   # flattened text
        }

    Non-message records (progress, file-history-snapshot, system,
    queue-operation, last-prompt) are filtered out. Malformed lines are
    skipped silently — data quality is the transcript writer's problem,
    not ours.

    Raises ``OSError`` when ``path`` is not a regular file. ``rglob`` in
    ``sweep_directory`` lists a FIFO named ``session.jsonl`` like any
    other match, and opening one for reading blocks in the kernel until a
    writer appears — an unbounded hang for the whole sweep. ``stat`` never
    blocks on one, and it raises for a missing path exactly as ``open``
    did before, so callers see the same error for the same mistake.
    """
    if not stat.S_ISREG(Path(path).stat().st_mode):
        raise OSError(f"Refusing non-regular file: {path}")
    with open(path, "r", encoding="utf-8", errors="replace") as f:
        for line in f:
            line = line.strip()
            if not line:
                continue
            try:
                record = json.loads(line)
            except json.JSONDecodeError:
                continue
            rtype = record.get("type")
            if rtype not in ("user", "assistant"):
                continue
            msg = record.get("message") or {}
            if not isinstance(msg, dict):
                continue
            role = msg.get("role")
            if role not in ("user", "assistant"):
                continue

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Point the sweeper at a regular file

When it happens

Trigger: Thrown at mempalace/sweeper.py:114 when the library encounters an invalid state.

Common situations: Sweeper path was not a regular file.


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