MemPalace/mempalace · error · RuntimeError
Refusing symlinked file: {path}
Error message
Refusing symlinked file: {path} What it means
Error "Refusing symlinked file: {path}" thrown in MemPalace/mempalace.
Source
Thrown at mempalace/repair.py:78
def _no_follow_flag() -> int:
return getattr(os, "O_NOFOLLOW", 0)
def _non_blocking_flag() -> int:
"""Return O_NONBLOCK, or 0 where the platform has no such flag (Windows).
Without it the ``S_ISREG`` refusal in ``_open_regular_file_no_follow``
is unreachable for a FIFO: opening one for reading blocks in the kernel
until a writer appears, so ``repair`` would wedge instead of refusing.
"""
return getattr(os, "O_NONBLOCK", 0)
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)
raiseView on GitHub (pinned to 06cb6987f0)
Solutions
- Replace the symlink with the real file
When it happens
Trigger: Thrown at mempalace/repair.py:78 when the library encounters an invalid state.
Common situations: Repair refuses to operate on symlinked files.
AI-assisted analysis of MemPalace/mempalace@06cb6987f0 (2026-08-15).
Data as JSON: /api/errors/1d89c4d2a2bf3f25.
Report an issue: GitHub.