MemPalace/mempalace · error · RuntimeError

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/repair.py:92


def _open_regular_file_no_follow(path: str) -> int:
    if os.path.islink(path):
        raise RuntimeError(f"Refusing symlinked file: {path}")
    flags = os.O_RDONLY | _no_follow_flag() | _non_blocking_flag()
    try:
        fd = os.open(path, flags)
    except OSError as exc:
        # EAGAIN here is a write-lease break, which the kernel grants on
        # regular files only, so re-check the type and open the way this
        # helper did before the flag existed. Anything else propagates.
        if exc.errno != errno.EAGAIN or not stat.S_ISREG(os.lstat(path).st_mode):
            raise
        fd = os.open(path, flags & ~_non_blocking_flag())
    try:
        st = os.fstat(fd)
        if not stat.S_ISREG(st.st_mode):
            raise RuntimeError(f"Refusing non-regular file: {path}")
        return fd
    except Exception:
        os.close(fd)
        raise


def _write_text_replace_no_follow(path: str, text: str) -> None:
    directory = os.path.dirname(path) or "."
    basename = os.path.basename(path)
    tmp_path = os.path.join(
        directory,
        f".{basename}.{os.getpid()}.{int(time.time() * 1_000_000)}.tmp",
    )
    fd = os.open(
        tmp_path,
        os.O_WRONLY | os.O_CREAT | os.O_EXCL | _no_follow_flag(),
        0o600,
    )

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Point repair at a regular file

When it happens

Trigger: Thrown at mempalace/repair.py:92 when the library encounters an invalid state.

Common situations: Repair path was a directory, socket, or device node.


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