You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cz bump crashes with version_provider=cargo on workspace virtual manifest (missing [package] / TypeError on version.workspace) #1732
Commitizen crashes when using version_provider = "cargo" on a Cargo workspace virtual manifest (root Cargo.toml contains [workspace] and [workspace.package] but no[package]). Our workspace members inherit version via version.workspace = true. Running cz bump fails inside commitizen/providers/cargo_provider.py while trying to update Cargo.lock.
This prevents using Commitizen’s cargo provider for monorepo-style Rust workspaces where the version is centralized in [workspace.package].version.
Steps to reproduce
Create a Cargo workspace that uses a virtual manifest at the root (no [package]), with a centralized version:
# ./Cargo.toml (workspace root)
[workspace]
members = ["crates/a"]
[workspace.package]
version = "0.1.0"edition = "2024"
Create a member crate that inherits the version via version.workspace = true:
# ./crates/a/Cargo.toml
[package]
name = "a"version.workspace = trueedition.workspace = true
cz bump crashes with exceptions from cargo_provider.py:
tomlkit.exceptions.NonExistentKey: 'Key "package" does not exist.' (root manifest has no [package])
then TypeError: string indices must be integers, not 'str' (when accessing package_content["version"]["workspace"] for members)
The command terminates without completing the bump/tag operation.
Desired behavior
cz bump should support Cargo workspaces with a virtual manifest (root Cargo.toml has [workspace] / [workspace.package] but no [package]) and members using version.workspace = true.
Concretely:
Read and bump the canonical version from [workspace.package].version.
Do not assume [package] exists in the workspace root manifest.
When scanning/updating member manifests, correctly handle version.workspace = true (a nested table / boolean) without type errors.
bump: version 0.1.0 → 0.2.0
tag to create: v0.2.0
increment detected: MINOR
[master 6c6752a] bump: version 0.1.0 → 0.2.0
2 files changed, 6 insertions(+), 1 deletion(-)
create mode 100644 CHANGELOG.md
Done!
No NonExistentKey, no TypeError, exit 0.
Verdict: FIXED on master.
The issue-status: pr-created label is from a fix that's apparently already landed. This is closing-eligible. (If the original Cargo.lock corner-case wasn't covered by the merged PR, please share a fresh repro and we can re-open.)
Closing as fixed on master: workspace virtual-manifest case now works correctly. See verification comment above. (Linked PR appears to have already landed.)
Activity
bearomorphism commentedon May 9, 2026
Triage from #1964: A PR has already been opened for this (
issue-status: pr-created). Reviewers welcome.bearomorphism commentedon May 9, 2026
Verification update (re #1964)
Reproduced the exact setup from this issue against current master (4.15.1):
[workspace]+[workspace.package](no[package])crates/a/Cargo.tomlwithversion.workspace = trueversion_provider = "cargo"+update_changelog_on_bump = truecz bump --yessucceeds:No
NonExistentKey, noTypeError, exit 0.Verdict: FIXED on master.
The
issue-status: pr-createdlabel is from a fix that's apparently already landed. This is closing-eligible. (If the originalCargo.lockcorner-case wasn't covered by the merged PR, please share a fresh repro and we can re-open.)bearomorphism commentedon May 9, 2026
Closing as fixed on master: workspace virtual-manifest case now works correctly. See verification comment above. (Linked PR appears to have already landed.)