denoland/deno · error · SystemError

ERR_FS_CP_FIFO_PIPE

ERR_FS_CP_FIFO_PIPE

Error message

Cannot copy a FIFO pipe

What it means

Mirror of the socket case: when the source stat identifies a FIFO (named pipe), fs.cp rejects with CpError::Fifo (kind 'FIFO'), mapped by throwCpError to ERR_FS_CP_FIFO_PIPE ('Cannot copy a FIFO pipe', errno EINVAL). A FIFO is a kernel rendezvous object with no data to read by copy; reading it would block on the writer side, so the operation is refused outright.

Solutions

  1. Filter out FIFOs during recursive copy via lstat + stats.isFIFO()
  2. Remove stale FIFOs before archiving (they are recreated by their producers)
  3. Restrict the copy to the entries you know are regular files/dirs, e.g. with a filter or explicit list

Example fix

// before
fs.cp('runtime/', 'snap/', { recursive: true }, cb); // runtime/ has logs.fifo

// after
fs.cp('runtime/', 'snap/', {
  recursive: true,
  filter: (src) => !fs.lstatSync(src).isFIFO(),
}, cb);
Defensive patterns

Strategy: validation

Validate before calling

const filter = (src) => !fs.lstatSync(src).isFIFO();
fs.cpSync(src, dest, { recursive: true, filter });

Type guard

const isFifoEntry = (st) => st.isFIFO();

Try / catch

try { await fs.promises.cp(src, dest, { recursive: true }); } catch (e) { if (e.code === 'ERR_FS_CP_FIFO_PIPE') { /* rerun with an isFIFO filter */ } else throw e; }

Prevention

When it happens

Trigger: fs.cp recursive over a directory containing mkfifo-created entries (logs.fifo, common in log pipelines); copying a mount that exposes device/IPC entries; test fixtures that deliberately create FIFOs being swept by a copy task.

Common situations: Devops scripts archiving runtime directories that contain logging or IPC FIFOs; packaging steps that walk /tmp-heavy workspaces; reproducible-build tooling hitting fixture leftovers.

Related errors


AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20). Data as JSON: /api/errors/48a667fefd58f324. Report an issue: GitHub.

Appendix: source

Thrown at ext/node/polyfills/_fs/cp/cp.ts:108

      });
    case "EISDIR":
      throw new ERR_FS_EISDIR({
        message: err.message,
        path: err.path,
        syscall: "cp",
        errno: EISDIR,
        code: "EISDIR",
      });
    case "SOCKET":
      throw new ERR_FS_CP_SOCKET({
        message: err.message,
        path: err.path,
        syscall: "cp",
        errno: EINVAL,
        code: "EINVAL",
      });
    case "FIFO":
      throw new ERR_FS_CP_FIFO_PIPE({
        message: err.message,
        path: err.path,
        syscall: "cp",
        errno: EINVAL,
        code: "EINVAL",
      });
    case "UNKNOWN":
      throw new ERR_FS_CP_UNKNOWN({
        message: err.message,
        path: err.path,
        syscall: "cp",
        errno: EINVAL,
        code: "EINVAL",
      });
    case "SYMLINK_TO_SUBDIRECTORY":
      throw new ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY({
        message: err.message,
        path: err.path,

View on GitHub (pinned to 9ad36f7a2c)