{"record":{"id":"1a5da7655a6b9e98","repo":"MemPalace/mempalace","slug":"refusing-non-regular-file-path","errorCode":null,"errorMessage":"Refusing non-regular file: {path}","messagePattern":"Refusing non-regular file: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"mempalace/repair.py","lineNumber":92,"sourceCode":"\n\ndef _open_regular_file_no_follow(path: str) -> int:\n    if os.path.islink(path):\n        raise RuntimeError(f\"Refusing symlinked file: {path}\")\n    flags = os.O_RDONLY | _no_follow_flag() | _non_blocking_flag()\n    try:\n        fd = os.open(path, flags)\n    except OSError as exc:\n        # EAGAIN here is a write-lease break, which the kernel grants on\n        # regular files only, so re-check the type and open the way this\n        # helper did before the flag existed. Anything else propagates.\n        if exc.errno != errno.EAGAIN or not stat.S_ISREG(os.lstat(path).st_mode):\n            raise\n        fd = os.open(path, flags & ~_non_blocking_flag())\n    try:\n        st = os.fstat(fd)\n        if not stat.S_ISREG(st.st_mode):\n            raise RuntimeError(f\"Refusing non-regular file: {path}\")\n        return fd\n    except Exception:\n        os.close(fd)\n        raise\n\n\ndef _write_text_replace_no_follow(path: str, text: str) -> None:\n    directory = os.path.dirname(path) or \".\"\n    basename = os.path.basename(path)\n    tmp_path = os.path.join(\n        directory,\n        f\".{basename}.{os.getpid()}.{int(time.time() * 1_000_000)}.tmp\",\n    )\n    fd = os.open(\n        tmp_path,\n        os.O_WRONLY | os.O_CREAT | os.O_EXCL | _no_follow_flag(),\n        0o600,\n    )","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/repair.py#L74-L110","documentation":"Error \"Refusing non-regular file: {path}\" thrown in MemPalace/mempalace.","triggerScenarios":"Thrown at mempalace/repair.py:92 when the library encounters an invalid state.","commonSituations":"Repair path was a directory, socket, or device node.","solutions":["Point repair 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"}