jdx/mise · error

unsupported host path type: {host_path.display}

Error message

unsupported host path type: {host_path.display}

What it means

build_layer_from_path classifies the host path into Dir, Symlink, or File. Anything else — most commonly FIFOs, device nodes, or sockets — cannot be represented by this layer builder, so it throws this error listing the offending path.

Source

Thrown at src/oci/layer.rs:189

        eyre::bail!("cannot copy a file or symlink to the image root");
    }
    if image_path.ends_with('/') {
        eyre::bail!(
            "copy image path {image_path:?} ends with `/` but {} is not a directory; \
             specify the exact destination file name",
            host_path.display()
        );
    }

    let kind = if metadata.file_type().is_symlink() {
        EntryKind::Symlink(
            std::fs::read_link(host_path)
                .wrap_err_with(|| format!("reading symlink {}", host_path.display()))?,
        )
    } else if metadata.is_file() {
        EntryKind::File
    } else {
        eyre::bail!("unsupported host path type: {}", host_path.display());
    };
    let mode = match &kind {
        EntryKind::Symlink(_) => 0o777,
        EntryKind::File if file_is_executable(host_path, &metadata) => 0o755,
        EntryKind::File => 0o644,
        EntryKind::Dir => unreachable!(),
    };
    let target_path = Path::new(target);
    let rel = target_path
        .file_name()
        .map(PathBuf::from)
        .ok_or_else(|| eyre::eyre!("copy image path has no file name: {image_path}"))?;
    let prefix = target_path
        .parent()
        .unwrap_or_else(|| Path::new(""))
        .to_string_lossy();
    let size = if matches!(kind, EntryKind::Symlink(_)) {
        0

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Remove the special file from the source directory or exclude it from the copy spec before building the layer.
  2. Replace the FIFO/socket with a regular file (or create it at container runtime instead of baking it into the image).
  3. If the path should have been a regular file, inspect what created it — a leftover runtime artifact usually means the src_dir needs cleaning.

Example fix

// before
copy spec includes ./run/app.sock (a socket)
// after
rm ./run/app.sock   # or exclude ./run from the copy spec
Defensive patterns

Strategy: validation

Validate before calling

function assertSupportedKind(p) {
  const st = fs.lstatSync(p);
  if (!(st.isDirectory() || st.isFile() || st.isSymbolicLink())) {
    throw new Error(`unsupported path type (fifo/socket/device?): ${p}`);
  }
}

Type guard

fn is_layerable(p: &Path) -> bool {
    match std::fs::symlink_metadata(p) {
        Ok(m) => m.is_dir() || m.is_file() || m.file_type().is_symlink(),
        Err(_) => false,
    }
}

Try / catch

match build_layer_from_path(&host, image_path, owner) {
    Err(e) if e.to_string().contains("unsupported host path type") => {
        eprintln!("exclude the special file (fifo/socket/device) from the copy spec: {host:?}");
    }
    r => r,
}

Prevention

When it happens

Trigger: Calling build_layer_from_path with a host path that is neither a directory, a symlink, nor a regular file — e.g. a named pipe (mkfifo), a unix socket, or a device node under /dev — so metadata matches none of the supported kinds.

Common situations: Accidentally including a socket or FIFO from a working/runtime directory in a copy spec; a broken special file created by a build step; pointing the layer builder at /dev or /proc entries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/f99fd19fd7be651e. Report an issue: GitHub.