volta-cli/volta · error · syn::Error

executable ` ` (on non-Windows operating systems) is a…

Error message

executable `{}` (on non-Windows operating systems) is a duplicate of `{}` filename

What it means

This is a compile-time error from the layout! proc macro: filenames within a directory must be unique after `.exe` normalization. When an executable entry declared as `name[.exe]` collides with a previously declared entry of the same base name, the macro reports it — here specifically that the executable is a duplicate of an already-declared plain filename (or directory name), because on non-Windows both occupy the same on-disk name.

Solutions

  1. Keep only one of the two colliding entries — usually the `name[.exe]` form, which covers both platforms
  2. Rename or remove the pre-existing plain file/directory that the executable collides with
  3. Move the executable to a different directory if both entries are genuinely required

Example fix

// before
"bin": dir { "node": file; "node[.exe]": file; }
// after
"bin": dir { "node[.exe]": file; }
Defensive patterns

Strategy: validation

Validate before calling

fn has_exe_collision(names: &[&str]) -> bool {
    let mut seen = std::collections::HashSet::new();
    names.iter().any(|n| !seen.insert(n.strip_suffix("[.exe]").unwrap_or(n)))
}

Try / catch

// compile-time proc-macro error: no runtime catch. Normalize names by stripping [.exe]
// and de-duplicate in review/CI before cargo build.

Prevention

When it happens

Trigger: Declaring `"name[.exe]": file;` after an entry named `"name"` (file or directory) already exists in the same layout! directory block.

Common situations: Declaring both "node" and "node[.exe]" in the same directory; converting a plain file entry to an executable without removing the original; copying platform-specific layout fragments into a shared block.

Understand the failure class

Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.

Related errors


AI-assisted analysis of volta-cli/volta@5eedd5fb2f (2026-09-08). Data as JSON: /api/errors/04c9b1016f213ef3. Report an issue: GitHub.

Appendix: source

Thrown at crates/volta-layout-macro/src/ast.rs:190

                }
                _ => {
                    let filename = prefix.filename.value();
                    if filename.ends_with("[.exe]") {
                        let filename = &filename[0..filename.len() - 6];

                        if let Some(kind) = visited_entries.get(filename) {
                            let message = match kind {
                                EntryKind::Exe => {
                                    format!("duplicate filename `{}.exe`", filename)
                                }
                                EntryKind::File => {
                                    format!("executable `{}` (on non-Windows operating systems) is a duplicate of `{}` filename", filename, filename)
                                }
                                EntryKind::Dir => {
                                    format!("executable `{}` (on non-Windows operating systems) is a duplicate of `{}` directory name", filename, filename)
                                }
                            };
                            let error = syn::Error::new(prefix.filename.span(), message);
                            return Err(error.to_compile_error());
                        }

                        visited_entries.insert(filename.to_string(), EntryKind::Exe);
                        entry.filename = LitStr::new(filename, prefix.filename.span());
                        results.exes.push(entry);
                    } else {
                        if let Some(kind) = visited_entries.get(&filename) {
                            let message = match kind {
                                EntryKind::Exe => {
                                    format!("filename `{}` is a duplicate of `{}` executable on non-Windows operating systems", filename, filename)
                                }
                                _ => {
                                    format!("duplicate filename `{}`", filename)
                                }
                            };
                            let error = syn::Error::new(prefix.filename.span(), message);
                            return Err(error.to_compile_error());

View on GitHub (pinned to 5eedd5fb2f)