{"record":{"id":"04c9b1016f213ef3","repo":"volta-cli/volta","slug":"executable-on-non-windows-operating-systems","errorCode":null,"errorMessage":"executable `{}` (on non-Windows operating systems) is a duplicate of `{}` filename","messagePattern":"executable `(.+?)` \\(on non-Windows operating systems\\) is a duplicate of `(.+?)` filename","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/volta-layout-macro/src/ast.rs","lineNumber":190,"sourceCode":"                }\n                _ => {\n                    let filename = prefix.filename.value();\n                    if filename.ends_with(\"[.exe]\") {\n                        let filename = &filename[0..filename.len() - 6];\n\n                        if let Some(kind) = visited_entries.get(filename) {\n                            let message = match kind {\n                                EntryKind::Exe => {\n                                    format!(\"duplicate filename `{}.exe`\", filename)\n                                }\n                                EntryKind::File => {\n                                    format!(\"executable `{}` (on non-Windows operating systems) is a duplicate of `{}` filename\", filename, filename)\n                                }\n                                EntryKind::Dir => {\n                                    format!(\"executable `{}` (on non-Windows operating systems) is a duplicate of `{}` directory name\", filename, filename)\n                                }\n                            };\n                            let error = syn::Error::new(prefix.filename.span(), message);\n                            return Err(error.to_compile_error());\n                        }\n\n                        visited_entries.insert(filename.to_string(), EntryKind::Exe);\n                        entry.filename = LitStr::new(filename, prefix.filename.span());\n                        results.exes.push(entry);\n                    } else {\n                        if let Some(kind) = visited_entries.get(&filename) {\n                            let message = match kind {\n                                EntryKind::Exe => {\n                                    format!(\"filename `{}` is a duplicate of `{}` executable on non-Windows operating systems\", filename, filename)\n                                }\n                                _ => {\n                                    format!(\"duplicate filename `{}`\", filename)\n                                }\n                            };\n                            let error = syn::Error::new(prefix.filename.span(), message);\n                            return Err(error.to_compile_error());","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/volta-cli/volta/blob/5eedd5fb2f682baceb47a242289111fcd79435a5/crates/volta-layout-macro/src/ast.rs#L172-L208","documentation":"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.","triggerScenarios":"Declaring `\"name[.exe]\": file;` after an entry named `\"name\"` (file or directory) already exists in the same layout! directory block.","commonSituations":"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.","solutions":["Keep only one of the two colliding entries — usually the `name[.exe]` form, which covers both platforms","Rename or remove the pre-existing plain file/directory that the executable collides with","Move the executable to a different directory if both entries are genuinely required"],"exampleFix":"// before\n\"bin\": dir { \"node\": file; \"node[.exe]\": file; }\n// after\n\"bin\": dir { \"node[.exe]\": file; }","handlingStrategy":"validation","validationCode":"fn has_exe_collision(names: &[&str]) -> bool {\n    let mut seen = std::collections::HashSet::new();\n    names.iter().any(|n| !seen.insert(n.strip_suffix(\"[.exe]\").unwrap_or(n)))\n}","typeGuard":null,"tryCatchPattern":"// compile-time proc-macro error: no runtime catch. Normalize names by stripping [.exe]\n// and de-duplicate in review/CI before cargo build.","preventionTips":["Treat \"name\" and \"name[.exe]\" as the same filename when designing a layout","Declare platform-shared executables once with the [.exe] suffix and delete plain duplicates","Keep platform-specific entries in separate directory blocks to avoid accidental collisions"],"tags":["proc-macro","compile-time","duplicate","rust"],"backgroundTag":"file-already-exists","analyzedSha":"5eedd5fb2f682baceb47a242289111fcd79435a5","analyzedAt":"2026-09-08T00:01:15.963Z","contentChangedAt":"2026-09-08T00:01:15.963Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}