dbt-labs/dbt-core · error · syn::Error
`name` set multiple times.
Error message
`name` set multiple times.
What it means
A proc-macro (`#[entry]`-style attribute in dbt-runtime-macros) accepts a `name = "..."` option at most once. `set_name` errors when the attribute block specifies `name` a second time. This is a compile-time syn::Error attributed to the offending span.
Source
Thrown at crates/dbt-runtime-macros/src/entry.rs:118
Configuration {
name: None,
rt_multi_thread_available: rt_multi_thread,
default_flavor: match is_test {
true => RuntimeFlavor::CurrentThread,
false => RuntimeFlavor::Threaded,
},
flavor: None,
worker_threads: None,
start_paused: None,
is_test,
crate_name: None,
unhandled_panic: None,
}
}
fn set_name(&mut self, name: syn::Lit, span: Span) -> Result<(), syn::Error> {
if self.name.is_some() {
return Err(syn::Error::new(span, "`name` set multiple times."));
}
let runtime_name = parse_string(name, span, "name")?;
self.name = Some(runtime_name);
Ok(())
}
fn set_flavor(&mut self, runtime: syn::Lit, span: Span) -> Result<(), syn::Error> {
if self.flavor.is_some() {
return Err(syn::Error::new(span, "`flavor` set multiple times."));
}
let runtime_str = parse_string(runtime, span, "flavor")?;
let runtime =
RuntimeFlavor::from_str(&runtime_str).map_err(|err| syn::Error::new(span, err))?;
self.flavor = Some(runtime);
Ok(())
}View on GitHub (pinned to 0267ce9170)
Solutions
- Remove the duplicate `name = "..."` entry, keeping only one.
- If both values are meaningful, rename one option or nest them (e.g. separate the runtime name from another identifier).
- Regenerate the annotated code if it came from a macro/codegen template that can duplicate options.
Example fix
// before #[entry(name = "alpha", name = "beta")] // after #[entry(name = "alpha")]
Defensive patterns
Strategy: validation
Validate before calling
// grep CI check: no duplicated options in entry attributes // rg -n 'name\s*=.*name\s*=' --glob '*.rs' crates/
Prevention
- Keep each macro option specified exactly once per attribute
- Fix merge conflicts that duplicate attribute lines
- Check codegen templates for repeated option emission
When it happens
Trigger: Writing the attribute as `#[entry(name = "a", name = "b")]` (or repeating `name` across accumulated attribute args) on the annotated item — `build_config` routes each literal to `set_name`, which sees the field already set.
Common situations: Merging two copies of an attribute during a refactor or code-gen; copy-pasting an attribute block that already contained `name`; hand-editing generated macro invocations.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- `flavor` set multiple times.
- No such runtime flavor `{s}`. The runtime flavors are `curre
- No such unhandled panic behavior `{s}`. The unhandled panic
- Unnamed field not supported
- `worker_threads` set multiple times.
AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07).
Data as JSON: /api/errors/5dbf232b5d7d1228.
Report an issue: GitHub.