diem/diem · error
Duplicate renaming of named address '{0}' found for dependen
Error message
Duplicate renaming of named address '{0}' found for dependency {1} What it means
Within one dependency entry, two different named addresses are renamed to the same target name. The renaming map would lose one mapping, so the substitution is rejected.
Source
Thrown at language/tools/move-package/src/resolution/resolution_graph.rs:376
match rename_from_or_assign {
SubstOrRename::RenameFrom(ident) => {
// Make sure dep has the address that we're importing
if !resolving_dep.resolution_table.contains_key(&ident) {
bail!(
"Tried to rename named address {0} from package '{1}'.\
However, {1} does not contain that address",
ident,
dep_name_in_pkg
);
}
// Apply the substitution, NB that the refcell for the address's value is kept!
if let Some(other_val) = resolution_table.remove(&ident) {
resolution_table.insert(name, other_val);
}
if renaming.insert(name, (dep_name_in_pkg, ident)).is_some() {
bail!("Duplicate renaming of named address '{0}' found for dependency {1}",
name,
dep_name_in_pkg,
);
}
}
SubstOrRename::Assign(value) => {
resolution_table
.get(&name)
.map(|named_addr| named_addr.unify(Some(value)))
.transpose()
.with_context(|| {
format!(
"Unable to assign value to named address {} in dependency {}",
name, dep_name_in_pkg
)
})?;
}
}View on GitHub (pinned to fc4714a8ea)
Solutions
- Give each rename a unique target name in the dependency substitution
- Delete the duplicated rename entry
Example fix
// before
[dependencies.Dep]
a1 = { rename_from = "x" }
a1 = { rename_from = "y" } // same target
// after
[dependencies.Dep]
a1 = { rename_from = "x" }
a2 = { rename_from = "y" } Defensive patterns
Strategy: validation
Validate before calling
def check_dep_renames(subst):
targets = [name for name, _ in subst.items()]
assert len(targets) == len(set(targets)), 'duplicate rename targets in dep' Type guard
def unique_targets(subst: dict) -> bool:
return len(subst) == len(set(subst.keys())) Prevention
- Never duplicate a rename target key within one dependency block
- Review generated Move.toml templates for repeated keys
- TOML parsers reject exact duplicate keys — watch for same-target renames instead
When it happens
Trigger: process_dependency's renaming.insert(name, ...) returns Some because the same target name was already used by a previous RenameFrom in the same dep's subst.
Common situations: Copy-pasted substitution lines in Move.toml where two renames accidentally share the target key; bulk renames during a refactor.
Related errors
- Tried to rename named address {0} from package '{1}'. Howeve
- Duplicate renaming of named address '{}' found in dependency
- Unbound struct {}
- Unbound function {}.{}
- Invalid named address assignment. Must be of the form <addre
AI-assisted analysis of diem/diem@fc4714a8ea (2026-09-04).
Data as JSON: /api/errors/fa25cd11fa0a5fcc.
Report an issue: GitHub.