zed-industries/zed · error

is not a table in workspace dependencies

Error message

{} is not a table in workspace dependencies

What it means

Thrown by `update_dependency_version_in_doc` (tooling/xtask/src/tasks/gpui.rs:257) when a [workspace.dependencies] entry parsed via toml_edit is not a TOML table (e.g. it's a bare string or inline value). The function only knows how to rewrite table-shaped dependency entries (setting version/package keys), so it bails rather than corrupting the manifest. Called by update_workspace_dependency_version and the unit test test_update_dependency_version_in_toml.

Solutions

  1. Rewrite the offending [workspace.dependencies] entry as a table: `name = { version = "x.y.z", ... }`.
  2. Run `cargo check`/`cargo metadata` to confirm the manifest parses, then re-run the publish xtask.
  3. Inspect the entry near the reported package_name for missing braces or a flattened value.

Example fix

# before
[workspace.dependencies]
anyhow = "1.0"

# after
[workspace.dependencies]
anyhow = { version = "1.0" }
Defensive patterns

Strategy: validation

Validate before calling

let doc: toml::Table = toml::from_str(&std::fs::read_to_string("Cargo.toml")?)?;
for (k, v) in doc["workspace"]["dependencies"].as_table().unwrap() {
    assert!(v.is_table(), "workspace dependency '{}' is not a table", k);
}

Prevention

When it happens

Trigger: A [workspace.dependencies] key is written as a bare version string (e.g. `serde = "1.0"`) or any non-table value instead of a table/inline table (`serde = { version = "1.0", workspace = true }`), and the publish task attempts to update its version.

Common situations: Hand-edited Cargo.toml entries that dropped the `{ ... }` braces; dependencies on registry crates pinned as plain strings; automated formatting or merge conflicts that flattened inline tables.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


AI-assisted analysis of zed-industries/zed@916fc2b8cb (2026-09-19). Data as JSON: /api/errors/138eea0f8b9bc5d0. Report an issue: GitHub.

Appendix: source

Thrown at tooling/xtask/src/tasks/gpui.rs:257

    doc: &mut toml_edit::DocumentMut,
    package_name: &str,
    crate_name: &str,
    new_version: &str,
) -> Result<()> {
    let dependency = doc
        .get_mut("workspace")
        .and_then(|w| w.get_mut("dependencies"))
        .and_then(|d| d.get_mut(package_name))
        .context(format!(
            "Failed to find {} in workspace dependencies",
            package_name
        ))?;

    if let Some(dep_table) = dependency.as_table_like_mut() {
        dep_table.insert("version", toml_edit::value(new_version));
        dep_table.insert("package", toml_edit::value(crate_name));
    } else {
        bail!("{} is not a table in workspace dependencies", package_name);
    }

    Ok(())
}

fn update_profile_override_in_doc(
    doc: &mut toml_edit::DocumentMut,
    package_name: &str,
    crate_name: &str,
) -> Result<()> {
    if let Some(profile_dev_package) = doc
        .get_mut("profile")
        .and_then(|p| p.get_mut("dev"))
        .and_then(|d| d.get_mut("package"))
        .and_then(|p| p.as_table_like_mut())
    {
        if let Some(old_entry) = profile_dev_package.get(package_name) {
            let old_entry_clone = old_entry.clone();

View on GitHub (pinned to 916fc2b8cb)