wasmerio/wasmer · error

failed to determine file type for '{}'

Error message

failed to determine file type for '{}'

What it means

create_zip_archive in lib/sdk/src/app/deploy_remote_build.rs walks the app directory and needs each entry's file type to decide how to add it to the zip. `entry.file_type()` (from the DirEntry walker) returns None when the type cannot be determined (e.g. broken symlink or an io error statting the entry), and the code then raises this error naming the path.

Source

Thrown at lib/sdk/src/app/deploy_remote_build.rs:328

            .git_global(true)
            .require_git(true)
            .parents(true)
            .follow_links(false);

        // Ignore .shipit directories, since they are for local use only.
        let mut overrides = ignore::overrides::OverrideBuilder::new(".");
        overrides.add("!.shipit").expect("valid override");
        b.overrides(overrides.build()?);

        b.build()
    };

    let entries = walker.into_iter();
    for entry in entries {
        let entry = entry?;

        let ty = entry.file_type().ok_or_else(|| {
            anyhow::anyhow!(
                "failed to determine file type for '{}'",
                entry.path().display()
            )
        })?;

        let rel_path = entry.path().strip_prefix(base_dir)?;

        if ty.is_symlink() {
            bail!(
                "cannot deploy projects containing symbolic links (found '{}')",
                rel_path.display()
            );
        }

        let rel_str = rel_path.to_string_lossy().replace('\\', "/");

        if ty.is_dir() {
            writer.add_directory(format!("{rel_str}/"), SimpleFileOptions::default())?;

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Find and remove/fix broken symlinks: `find . -xtype l` inside the app directory, delete or repoint them.
  2. Ensure nothing else is modifying the directory during deploy (stop watchers/builders, then retry).
  3. Add problematic paths to .wasmerignore / .gitignore so the walker skips them.
  4. Copy the app to a local filesystem directory and deploy from there if on a network mount.
  5. Check permissions: `ls -la` the reported path to confirm it is stat-able by your user.

Example fix

// shell: before deploying, clean dangling symlinks
find . -xtype l -print -delete
wasmer deploy
// or in .wasmerignore
node_modules
link-to-nowhere
Defensive patterns

Strategy: validation

Validate before calling

# shell: detect dangling symlinks in the app dir before deploying
find . -xtype l -print
# exit non-zero if any found, fix before `wasmer deploy`

Type guard

fn is_statable(e: &walkdir::DirEntry) -> bool { e.file_type().is_some() }

Try / catch

match create_zip_archive(&dir, &out) {
    Err(e) if e.to_string().contains("failed to determine file type") => {
        eprintln!("{e}\nHint: remove broken symlinks: find . -xtype l -delete");
        std::process::exit(1);
    }
    other => other,
}

Prevention

When it happens

Trigger: Zipping an app directory containing a dangling symlink, a file removed between directory walk and stat (race), or a filesystem where file_type metadata is unavailable (some network/FUSE mounts).

Common situations: App folder contains a symlink to a nonexistent target (e.g. node_modules/.bin links after partial install); files changing while `wasmer deploy` runs; deploying from an NFS/SMB share with flaky metadata; permission-restricted files.

Related errors


AI-assisted analysis of wasmerio/wasmer@8c4b9ee9d3 (2026-09-01). Data as JSON: /api/errors/1a0f915fe69b14d9. Report an issue: GitHub.