nikivdev/code · error
Workspace {} already exists at {}
Error message
Workspace {} already exists at {} What it means
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.
Source
Thrown at src/jj.rs:613
eprintln!(" continuing with current local refs");
}
}
let workspace_name = review_workspace_name(&branch);
if workspace_name.is_empty() {
bail!("Invalid review branch name: {}", branch);
}
let workspace_path = match path {
Some(p) => p,
None => workspace_default_path(&ctx.repo_root, &workspace_name)?,
};
if let Some(existing_path) =
existing_workspace_path(&ctx.workspace_root, &ctx.repo_root, &workspace_name)?
{
if existing_path != workspace_path {
bail!(
"Workspace {} already exists at {}",
workspace_name,
existing_path.display()
);
}
println!(
"Reusing review workspace {} at {}",
workspace_name,
existing_path.display()
);
} else {
let resolution = resolve_review_workspace_base(
&ctx.repo_root,
&branch,
&remote,
base.as_deref(),
);
run_workspace_add(View on GitHub (pinned to a747e741ae)
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.
Example fix
// before flow workspace feature/x --path /tmp/other # conflicts with existing path // after jj workspace delete feature-x flow workspace feature/x --path /tmp/other
Defensive patterns
Strategy: validation
Validate before calling
// shell jj workspace list | grep -q "$WS_NAME" && \ echo "workspace exists: $(jj workspace list | grep "$WS_NAME") — reuse or delete it first" && exit 1
Prevention
- 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.
When it happens
Trigger: `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.
Common situations: 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.
Related errors
- Refusing to overwrite {}
- env file not found: {}
- Path not found: {}
- Path must be a directory: {}
- Destination already exists: {}
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/0423e9742552e91b.
Report an issue: GitHub.