MemPalace/mempalace · error · IOError

Could not read {filepath}: not a regular file

Error message

Could not read {filepath}: not a regular file

What it means

Error "Could not read {filepath}: not a regular file" thrown in MemPalace/mempalace.

Source

Thrown at mempalace/normalize.py:143

    # blocking open of a FIFO waits in the kernel for a writer, so the
    # S_ISREG test never runs. See ``miner._read_text_no_follow``, including
    # why the EAGAIN branch re-checks the type and retries without the flag.
    flags = os.O_RDONLY | getattr(os, "O_NOFOLLOW", 0) | getattr(os, "O_NONBLOCK", 0)
    if os.path.islink(filepath):
        raise IOError(f"Could not read {filepath}: symlinked files are skipped")
    fd = -1
    try:
        try:
            fd = os.open(filepath, flags)
        except OSError as exc:
            if exc.errno != errno.EAGAIN or not stat.S_ISREG(os.lstat(filepath).st_mode):
                raise
            fd = os.open(filepath, flags & ~getattr(os, "O_NONBLOCK", 0))
        file_stat = os.fstat(fd)
        if not stat.S_ISREG(file_stat.st_mode):
            # Text stays prefix-free: this raise is inside the ``try``, so the
            # ``except OSError`` below composes "Could not read <path>: ...".
            raise IOError("not a regular file")
        if file_stat.st_size > 500 * 1024 * 1024:  # 500 MB safety limit
            # Prefix-free for the same reason as the branch above.
            raise IOError(f"file too large ({file_stat.st_size // (1024 * 1024)} MB)")
        with os.fdopen(fd, "r", encoding="utf-8-sig", errors="replace") as f:
            fd = -1
            return f.read()
    except OSError as e:
        raise IOError(f"Could not read {filepath}: {e}") from e
    finally:
        if fd != -1:
            try:
                os.close(fd)
            except OSError:
                pass


def normalize(filepath: str) -> str:
    """

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Pass a path to a regular file (not a directory, socket, or device)

When it happens

Trigger: Thrown at mempalace/normalize.py:143 when the library encounters an invalid state.

Common situations: The transcript path was not a regular file.


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