Hmbown/CodeWhale · error · ValidationError
workspace package is missing a name
Error message
workspace package is missing a name
What it means
At least one workspace package record has a 'name' that is missing, not a string, or empty. cargo metadata always emits a package name, so this is an integrity guard that fires on malformed or hand-built metadata rather than on a healthy workspace.
Source
Thrown at scripts/release/validate-crate-publish-order.py:94
"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-")
)
ordered_set = set(ordered_crates)
missing = sorted(set(release_names) - ordered_set)
extra = sorted(ordered_set - set(release_names))
if missing or extra:
messages = []
if missing:View on GitHub (pinned to 8880682c63)
Solutions
- Regenerate the fixture from real output: cargo metadata --locked --format-version 1 --no-deps
- Or add a non-empty string 'name' to the malformed package entry in the fixture
Defensive patterns
Strategy: type-guard
Type guard
def packages_all_named(packages: list) -> bool:
return all(isinstance(p, dict) and isinstance(p.get("name"), str) and p["name"] for p in packages) Prevention
- Generate synthetic fixtures from real cargo metadata output rather than hand-writing package dicts
When it happens
Trigger: A --metadata-file fixture whose package object omits 'name' or sets it to null/empty; a package dict replaced by a non-dict would be skipped by the id filter, but a dict with id and no name triggers this.
Common situations: Writing unit-test fixtures for the validator and forgetting the name field on a synthetic package.
Related errors
- Cargo metadata dependencies for {dependent} must be a list
- receipt metric `representative_context.fixture_id` must be `
- budget metric `representative_context.fixture_id` must be `{
- 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/f03846b9aeb7fd40.
Report an issue: GitHub.