Hmbown/CodeWhale · error · ValidationError
publish package list contains duplicates: {duplicate_crates}
Error message
publish package list contains duplicates: {duplicate_crates} What it means
The positional 'crates' arguments -- the maintained publication order, normally sourced from scripts/release/crates.sh -- contain the same crate name more than once. Duplicates would double-publish and corrupt the position arithmetic used for the topological check, so they are rejected before anything else in validate_order(). The sorted duplicate names are listed in the message.
Source
Thrown at scripts/release/validate-crate-publish-order.py:88
for package in packages
if isinstance(package, dict) and isinstance(package.get("id"), str)
}
missing_ids = [member for member in members if member not in packages_by_id]
if missing_ids:
raise ValidationError(
"Cargo metadata omits workspace package ids: " + ", ".join(missing_ids)
)
return [packages_by_id[member] for member in members]
def validate_order(
packages: list[dict[str, Any]], ordered_crates: list[str]
) -> tuple[str, dict[str, bool]]:
duplicate_crates = sorted(
{name for name in ordered_crates if ordered_crates.count(name) > 1}
)
if duplicate_crates:
raise ValidationError(
"publish package list contains duplicates: " + ", ".join(duplicate_crates)
)
names = [package.get("name") for package in packages]
if any(not isinstance(name, str) or not name for name in names):
raise ValidationError("workspace package is missing a name")
if len(set(names)) != len(names):
raise ValidationError("Cargo metadata contains duplicate workspace package names")
versions = sorted({package.get("version") for package in packages})
if len(versions) != 1 or not isinstance(versions[0], str) or not versions[0]:
rendered = ", ".join(str(version) for version in versions)
raise ValidationError(f"workspace packages have mixed versions: {rendered}")
workspace_by_name = {package["name"]: package for package in packages}
release_names = sorted(
name for name in workspace_by_name if name.startswith("codewhale-")
)View on GitHub (pinned to 8880682c63)
Solutions
- Remove the duplicate entries named in the message from scripts/release/crates.sh (the message lists them sorted)
- Sanity-check the list for dups before release: printf '%s\n' $(cat scripts/release/crates.sh list) | sort | uniq -d
- Re-run scripts/release/validate-crate-publish-order.py to confirm
Example fix
# scripts/release/crates.sh: before crates=(codewhale-protocol codewhale-tui codewhale-protocol codewhale-cli) # after crates=(codewhale-protocol codewhale-tui codewhale-cli)
Defensive patterns
Strategy: validation
Validate before calling
ordered_crates = ["codewhale-protocol", "codewhale-tui", "codewhale-cli"]
if len(set(ordered_crates)) != len(ordered_crates):
from collections import Counter
dupes = [c for c, n in Counter(ordered_crates).items() if n > 1]
raise SystemExit(f"duplicate crates in publish list: {dupes}") Prevention
- Keep crates.sh as the single source of the ordered list and have CI pass it verbatim to the validator
- Review merge conflicts in the crate list carefully -- duplicated lines are the usual origin
When it happens
Trigger: A copy-paste slip adds a crate twice to the ordered list in scripts/release/crates.sh; a merge conflict resolution keeps both copies of a line; invoking the validator manually and passing a name twice.
Common situations: Editing crates.sh while adding a new crate to the release inventory.
Related errors
- Cargo metadata contains duplicate workspace package names
- could not read Cargo metadata: {error}
- cargo metadata failed with exit code {process.returncode}{su
- Cargo metadata is not valid JSON: {error}
- Cargo metadata root must be an object
AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16).
Data as JSON: /api/errors/b99f75308fb0d4ce.
Report an issue: GitHub.