{"record":{"id":"ace7744391ad9515","repo":"MemPalace/mempalace","slug":"refusing-non-regular-file-path-ace774","errorCode":null,"errorMessage":"Refusing non-regular file: {path}","messagePattern":"Refusing non-regular file: (.+?)","errorType":"exception","errorClass":"OSError","httpStatus":null,"severity":"error","filePath":"mempalace/sweeper.py","lineNumber":114,"sourceCode":"          \"timestamp\":  str,   # ISO 8601\n          \"role\":       \"user\" | \"assistant\",\n          \"content\":    str,   # flattened text\n        }\n\n    Non-message records (progress, file-history-snapshot, system,\n    queue-operation, last-prompt) are filtered out. Malformed lines are\n    skipped silently — data quality is the transcript writer's problem,\n    not ours.\n\n    Raises ``OSError`` when ``path`` is not a regular file. ``rglob`` in\n    ``sweep_directory`` lists a FIFO named ``session.jsonl`` like any\n    other match, and opening one for reading blocks in the kernel until a\n    writer appears — an unbounded hang for the whole sweep. ``stat`` never\n    blocks on one, and it raises for a missing path exactly as ``open``\n    did before, so callers see the same error for the same mistake.\n    \"\"\"\n    if not stat.S_ISREG(Path(path).stat().st_mode):\n        raise OSError(f\"Refusing non-regular file: {path}\")\n    with open(path, \"r\", encoding=\"utf-8\", errors=\"replace\") as f:\n        for line in f:\n            line = line.strip()\n            if not line:\n                continue\n            try:\n                record = json.loads(line)\n            except json.JSONDecodeError:\n                continue\n            rtype = record.get(\"type\")\n            if rtype not in (\"user\", \"assistant\"):\n                continue\n            msg = record.get(\"message\") or {}\n            if not isinstance(msg, dict):\n                continue\n            role = msg.get(\"role\")\n            if role not in (\"user\", \"assistant\"):\n                continue","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/sweeper.py#L96-L132","documentation":"Error \"Refusing non-regular file: {path}\" thrown in MemPalace/mempalace.","triggerScenarios":"Thrown at mempalace/sweeper.py:114 when the library encounters an invalid state.","commonSituations":"Sweeper path was not a regular file.","solutions":["Point the sweeper at a regular file"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"06cb6987f02610784fefbad4b2bd5d026d164ba6","analyzedAt":"2026-08-15T03:03:36.213Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}