{"record":{"id":"4cd0a0d0d4fd6ef2","repo":"tokio-rs/tokio","slug":"crate-set-multiple-times","errorCode":null,"errorMessage":"`crate` set multiple times.","messagePattern":"`crate` set multiple times\\.","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"tokio-macros/src/entry.rs","lineNumber":158,"sourceCode":"            return Err(syn::Error::new(span, \"`worker_threads` may not be 0.\"));\n        }\n        self.worker_threads = Some((worker_threads, span));\n        Ok(())\n    }\n\n    fn set_start_paused(&mut self, start_paused: syn::Lit, span: Span) -> Result<(), syn::Error> {\n        if self.start_paused.is_some() {\n            return Err(syn::Error::new(span, \"`start_paused` set multiple times.\"));\n        }\n\n        let start_paused = parse_bool(start_paused, span, \"start_paused\")?;\n        self.start_paused = Some((start_paused, span));\n        Ok(())\n    }\n\n    fn set_crate_name(&mut self, name: syn::Lit, span: Span) -> Result<(), syn::Error> {\n        if self.crate_name.is_some() {\n            return Err(syn::Error::new(span, \"`crate` set multiple times.\"));\n        }\n        let name_path = parse_path(name, span, \"crate\")?;\n        self.crate_name = Some(name_path);\n        Ok(())\n    }\n\n    fn set_unhandled_panic(\n        &mut self,\n        unhandled_panic: syn::Lit,\n        span: Span,\n    ) -> Result<(), syn::Error> {\n        if self.unhandled_panic.is_some() {\n            return Err(syn::Error::new(\n                span,\n                \"`unhandled_panic` set multiple times.\",\n            ));\n        }\n","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/tokio-rs/tokio/blob/625954f365727668cb02d04172b34f1149637728/tokio-macros/src/entry.rs#L140-L176","documentation":"`set_crate_name` (entry.rs:156) records the first `crate = path` (an indirection used when tokio is re-exported under a different name) and rejects a second `crate` key in the same attribute.","triggerScenarios":"Writing `#[tokio::main(crate = my_tokio, crate = other)]`.","commonSituations":"Renaming the tokio dependency and leaving both the old and new `crate =` paths; merge conflicts in attributes.","solutions":["Keep a single `crate = path` matching the re-exported tokio path."],"exampleFix":"// before\n#[tokio::main(crate = renamed_tokio, crate = tokio)]\nasync fn main() {}\n\n// after\n#[tokio::main(crate = renamed_tokio)]\nasync fn main() {}","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set `crate = path` at most once, pointing at your tokio re-export.","Only needed when tokio is re-exported under a different crate name.","Remove the option entirely if you depend on tokio directly."],"tags":["tokio","macros","compile-error","config","duplicate-option","re-export"],"backgroundTag":null,"analyzedSha":"625954f365727668cb02d04172b34f1149637728","analyzedAt":"2026-08-11T17:46:45.378Z","contentChangedAt":"2026-08-11T17:46:45.378Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}