{"record":{"id":"0423e9742552e91b","repo":"nikivdev/code","slug":"workspace-already-exists-at","errorCode":null,"errorMessage":"Workspace {} already exists at {}","messagePattern":"Workspace (.+?) already exists at (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/jj.rs","lineNumber":613,"sourceCode":"                    eprintln!(\"  continuing with current local refs\");\n                }\n            }\n\n            let workspace_name = review_workspace_name(&branch);\n            if workspace_name.is_empty() {\n                bail!(\"Invalid review branch name: {}\", branch);\n            }\n\n            let workspace_path = match path {\n                Some(p) => p,\n                None => workspace_default_path(&ctx.repo_root, &workspace_name)?,\n            };\n\n            if let Some(existing_path) =\n                existing_workspace_path(&ctx.workspace_root, &ctx.repo_root, &workspace_name)?\n            {\n                if existing_path != workspace_path {\n                    bail!(\n                        \"Workspace {} already exists at {}\",\n                        workspace_name,\n                        existing_path.display()\n                    );\n                }\n                println!(\n                    \"Reusing review workspace {} at {}\",\n                    workspace_name,\n                    existing_path.display()\n                );\n            } else {\n                let resolution = resolve_review_workspace_base(\n                    &ctx.repo_root,\n                    &branch,\n                    &remote,\n                    base.as_deref(),\n                );\n                run_workspace_add(","sourceCodeStart":595,"sourceCodeEnd":631,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/jj.rs#L595-L631","documentation":"Before creating a review workspace, run_workspace checks existing_workspace_path. If a workspace with the same name already exists at a different path than the one requested, it bails to avoid two divergent checkouts of the same workspace name.","triggerScenarios":"`flow workspace <branch>` (run_workspace) when existing_workspace_path finds the workspace registered at path X but the resolved workspace_path (explicit --path or computed default) is Y, with X != Y.","commonSituations":"Passing a custom --path while the workspace already lives at its default location; moving/renaming the workspace directory manually without updating jj; re-running the command from a different repo clone.","solutions":["Reuse the existing location: run the command without --path, or cd to the printed existing path.","Remove the stale workspace first (`jj workspace delete <name>`) and re-create it at the desired path.","If the old directory was intentionally moved, delete the workspace record and recreate it there."],"exampleFix":"// before\nflow workspace feature/x --path /tmp/other   # conflicts with existing path\n// after\njj workspace delete feature-x\nflow workspace feature/x --path /tmp/other","handlingStrategy":"validation","validationCode":"// shell\njj workspace list | grep -q \"$WS_NAME\" && \\\n  echo \"workspace exists: $(jj workspace list | grep \"$WS_NAME\") — reuse or delete it first\" && exit 1","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check `jj workspace list` before creating a workspace with a custom --path.","Don't move workspace directories manually; use jj workspace commands.","Keep one canonical path per workspace per machine."],"tags":["cli","workspace","conflict","filesystem"],"backgroundTag":"workspace-already-exists","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}