jdx/mise · error

unsupported host path type

Error message

unsupported host path type: {}

What it means

`build_layer_from_path` classifies the host path as symlink, file, or directory to choose an EntryKind; any other file type (fifo, socket, device node) has no image representation here and fails with `unsupported host path type: <path>`.

Solutions

  1. Exclude sockets/fifos/devices from the copy set (filter or delete them from the source directory first).
  2. Copy the regular files you need explicitly instead of a broad directory sweep.
  3. If a device node is truly needed, create it at container start (entrypoint) rather than baking it into a layer.

Example fix

// before
build_layer_from_path("/run/app/app.sock", "/run/app/app.sock", owner)?; // error

// after
// skip non-regular entries
if src.is_dir() || src.is_file() || src.symlink_metadata().is_ok() && src.file_type().map(|t| t.is_symlink()).unwrap_or(false) {
    build_layer_from_path(src, "/run/app/app.sock", owner)?;
} else {
    eprintln!("skipping special file {}", src.display());
}
Defensive patterns

Strategy: validation

Validate before calling

let md = std::fs::symlink_metadata(host)?;
let ok = md.is_dir() || md.is_file() || md.file_type().is_symlink();
if !ok {
    bail!("skip special file {} (socket/fifo/device) before layering", host.display());
}

Try / catch

match build_layer_from_path(host, image_path, owner) {
    Err(e) if e.to_string().contains("unsupported host path type") => {
        eprintln!("skipping special file: {e}");
        Ok(())
    }
    r => r,
}

Prevention

When it happens

Trigger: Calling `build_layer_from_path` on a host path whose metadata is neither dir, file, nor symlink — e.g. a FIFO created by `mkfifo`, a unix socket, or a device file in the copy set.

Common situations: Copy rules over a directory tree that includes sockets/fifos generated at runtime (e.g. a dev server left a .sock file); including /run or /var/run contents; accidental inclusion of device nodes.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/5af828070b8db6af. Report an issue: GitHub.

Appendix: source

Thrown at src/oci/layer.rs:192

        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 533346cc37)