{"record":{"id":"be599b68bee32463","repo":"zed-industries/zed","slug":"current-directory-does-not-appear-to-be-a-workspace-root","errorCode":null,"errorMessage":"Current directory does not appear to be a workspace root. Please run this command from the workspace root.","messagePattern":"Current directory does not appear to be a workspace root\\. Please run this command from the workspace root\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tooling/xtask/src/tasks/gpui.rs","lineNumber":300,"sourceCode":"}\n\nfn check_workspace_root() -> Result<()> {\n    let cwd = std::env::current_dir().context(\"Failed to get current directory\")?;\n\n    // Check if Cargo.toml exists in the current directory\n    let cargo_toml_path = cwd.join(\"Cargo.toml\");\n    if !cargo_toml_path.exists() {\n        bail!(\n            \"Cargo.toml not found in current directory. Please run this command from the workspace root.\"\n        );\n    }\n\n    // Check if it's a workspace by looking for [workspace] section\n    let contents =\n        std::fs::read_to_string(&cargo_toml_path).context(\"Failed to read Cargo.toml\")?;\n\n    if !contents.contains(\"[workspace]\") {\n        bail!(\n            \"Current directory does not appear to be a workspace root. Please run this command from the workspace root.\"\n        );\n    }\n\n    Ok(())\n}\n\nfn check_git_clean() -> Result<()> {\n    let output = run_command(\n        Command::new(\"git\")\n            .args([\"status\", \"--porcelain\"])\n            .stdout(Stdio::piped())\n            .stderr(Stdio::piped()),\n    )?;\n\n    if !output.status.success() {\n        bail!(\"git status command failed\");\n    }","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/zed-industries/zed/blob/916fc2b8cb3a815cbef4a3b40e13081be72036b6/tooling/xtask/src/tasks/gpui.rs#L282-L318","documentation":"Also thrown by `check_workspace_root` (tooling/xtask/src/tasks/gpui.rs:300). A Cargo.toml exists in the current directory, but its contents do not contain a `[workspace]` section, so the directory is not the workspace root the publish pipeline requires. This prevents publishing against a standalone crate manifest by mistake.","triggerScenarios":"Running the publish xtask from a nested crate whose Cargo.toml has only [package], or from a non-workspace Cargo project; a root manifest where the [workspace] section was accidentally removed or renamed.","commonSituations":"Running from a vendored/sub-project directory; publishing a crate extracted from the monorepo; a broken merge that dropped the [workspace] table from the root Cargo.toml.","solutions":["Run the command from the monorepo root whose Cargo.toml contains [workspace] (usually the git repo root).","If you believe the directory IS the root, check the root Cargo.toml still declares `[workspace]` and restore it if missing.","Confirm with `grep -l '^\\[workspace\\]' Cargo.toml` in the intended directory before running."],"exampleFix":"# before (crate Cargo.toml, no workspace section)\n[package]\nname = \"gpui\"\n\n# after — run from root manifest\n[workspace]\nmembers = [\"crates/*\"]","handlingStrategy":"validation","validationCode":"let contents = std::fs::read_to_string(\"Cargo.toml\")?;\nassert!(contents.contains(\"[workspace]\"), \"current directory is not a workspace root\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify `[workspace]` is present in Cargo.toml before publishing.","Don't run publish from nested crate directories; always start at the monorepo root.","Keep the [workspace] section intact in root manifest reviews/merges."],"tags":["cargo","workspace","cli","manifest"],"backgroundTag":"not-a-workspace-root","analyzedSha":"916fc2b8cb3a815cbef4a3b40e13081be72036b6","analyzedAt":"2026-09-19T19:09:50.599Z","contentChangedAt":"2026-09-19T19:09:50.599Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}