{"record":{"id":"747bd240514d4dc7","repo":"swc-project/swc","slug":"multiple-entries-with-same-input-path-detected-v","errorCode":null,"errorMessage":"Multiple entries with same input path detected: {v:?}","messagePattern":"Multiple entries with same input path detected: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_bundler/src/bundler/chunk/plan/mod.rs","lineNumber":56,"sourceCode":"            .collect()\n    }\n}\n\nimpl<L, R> Bundler<'_, L, R>\nwhere\n    L: Load,\n    R: Resolve,\n{\n    pub(super) fn determine_entries(\n        &self,\n        entries: FxHashMap<String, TransformedModule>,\n    ) -> Result<(Plan, ModuleGraph, Vec<Vec<ModuleId>>), Error> {\n        let mut builder = PlanBuilder::default();\n        let mut analyzer = GraphAnalyzer::new(&self.scope);\n\n        for (name, module) in entries {\n            if let Some(v) = builder.kinds.insert(module.id, BundleKind::Named { name }) {\n                bail!(\"Multiple entries with same input path detected: {v:?}\")\n            }\n\n            analyzer.load(module.id);\n        }\n        let res = analyzer.into_result();\n\n        // dbg!(&builder.cycles);\n\n        Ok((\n            Plan {\n                entries: builder.kinds,\n                all: res.all,\n            },\n            res.graph,\n            res.cycles,\n        ))\n    }\n}","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_bundler/src/bundler/chunk/plan/mod.rs#L38-L74","documentation":"Bundler::determine_entries inserts each entry into the plan keyed by ModuleId (resolved absolute path). If a second entry maps to an id already present, the insert returns the previous BundleKind and swc bails with 'Multiple entries with same input path detected'. Entry display names may differ, but each resolved input path must be unique.","triggerScenarios":"Calling Bundler::bundle with entries like [(\"a\", \"./mod.js\"), (\"b\", \"./mod.js\")] - two names for one file; also entries that differ textually but resolve (symlinks, resolver canonicalization) to the same path.","commonSituations":"Generated entry lists that concatenate globs; monorepos referencing the same file via different specifiers; config-driven bundlers merging entry maps without dedup.","solutions":["Deduplicate entry paths before calling bundle()","If you need multiple output bundles sharing a source, run separate bundle invocations","Verify symlink/resolver canonicalization when you believe two paths are distinct"],"exampleFix":"// before (Rust)\nlet entries = vec![\n    (\"app\".into(), \"./mod.js\".into()),\n    (\"lib\".into(), \"./mod.js\".into()),\n];\n// after (Rust)\nlet entries = vec![(\"app\".into(), \"./mod.js\".into())];","handlingStrategy":"validation","validationCode":"// Rust - canonicalize and dedupe entries before bundling\nuse std::collections::HashSet;\nlet mut seen = HashSet::new();\nlet entries: Vec<(String, PathBuf)> = raw_entries\n    .into_iter()\n    .filter(|(_, path)| seen.insert(path.canonicalize().unwrap_or_else(|_| path.clone())))\n    .collect();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Deduplicate entry paths (after canonicalization) before calling bundle","Run separate bundle invocations when one source must feed multiple outputs","Validate generated entry lists in tests"],"tags":["swc","bundler","entry-points","duplicate-entry"],"backgroundTag":"duplicate-entry-point","analyzedSha":"5176682b65416c6b5de6b47379ae1588ea3ecb3f","analyzedAt":"2026-08-17T16:16:52.067Z","contentChangedAt":"2026-08-17T16:16:52.067Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}