BloopAI/vibe-kanban · error
Branch '{}' does not exist in repository '{}'
Error message
Branch '{}' does not exist in repository '{}' What it means
map_workspace_manager_error converts WorkspaceError::BranchNotFound into this message, interpolating the requested branch and repository names. It is thrown when an operation needs a branch (e.g. creating a workspace worktree or starting an execution) and git lookup shows the branch does not exist in that repository. It is a git-level precondition failure surfaced as ContainerError::Other.
Source
Thrown at crates/local-deployment/src/container.rs:151
}
fn map_workspace_manager_error(err: WorkspaceError) -> ContainerError {
match err {
WorkspaceError::Database(err) => ContainerError::Sqlx(err),
WorkspaceError::Worktree(err) => ContainerError::Worktree(err),
WorkspaceError::GitService(err) => ContainerError::GitServiceError(err),
WorkspaceError::Io(err) => ContainerError::Io(err),
WorkspaceError::NoRepositories => {
ContainerError::Other(anyhow!("No repositories provided"))
}
WorkspaceError::Repo(err) => ContainerError::Other(anyhow!(err)),
WorkspaceError::WorkspaceNotFound => {
ContainerError::Other(anyhow!("Workspace not found"))
}
WorkspaceError::RepoAlreadyAttached => {
ContainerError::Other(anyhow!("Repository already attached to workspace"))
}
WorkspaceError::BranchNotFound { repo_name, branch } => ContainerError::Other(anyhow!(
"Branch '{}' does not exist in repository '{}'",
branch,
repo_name
)),
WorkspaceError::PartialCreation(msg) => ContainerError::Other(anyhow!(msg)),
}
}
async fn workspace_repo_inputs(
&self,
workspace_id: Uuid,
) -> Result<(Vec<Repo>, Vec<RepoWorkspaceInput>), ContainerError> {
let workspace_repos =
WorkspaceRepo::find_by_workspace_id(&self.db.pool, workspace_id).await?;
if workspace_repos.is_empty() {
return Err(ContainerError::Other(anyhow!(
"Workspace has no repositories configured"
)));View on GitHub (pinned to 4deb7eca8f)
Solutions
- Verify the branch exists: run `git branch --list <branch>` (or `git ls-remote origin <branch>`) in the repo.
- Fetch the remote branch first (`git fetch origin <branch>:<branch>`) so it exists locally, then retry.
- Correct the target_branch value in the workspace/project configuration to an existing branch.
- Create the branch if intended: `git branch <branch> <base-ref>`.
Example fix
// before
let input = RepoWorkspaceInput::new(repo, "feature/fix"); // branch never fetched
// after
repo.git_fetch_branch("feature/fix").await?; // ensure local branch exists
let input = RepoWorkspaceInput::new(repo, "feature/fix"); Defensive patterns
Strategy: validation
Validate before calling
let ok = tokio::process::Command::new("git")
.args(["rev-parse", "--verify", &format!("refs/heads/{branch}")])
.current_dir(&repo.path)
.status().await?.success();
if !ok { return Err(anyhow!("branch {branch} missing in {}", repo.name)); } Try / catch
match container.create(&req).await {
Err(ContainerError::Other(e)) if e.to_string().contains("does not exist in repository") => {
// parse branch/repo from message, fetch or fix config, retry once
Err(e)
}
other => other,
} Prevention
- Validate branch names against `git branch --list` before creating workspaces.
- Always `git fetch` remote branches before referencing them.
- Keep branch config in sync when branches are deleted upstream.
- Default to the repo's HEAD/default branch when unset.
When it happens
Trigger: Creating a workspace whose target_branch for a repo does not exist locally in that repo; starting an execution pinned to a branch that was never fetched or was deleted.
Common situations: Typo'd branch name in workspace/project config; branch exists only on the remote and was never fetched; branch was force-deleted or rebased away; stale config after a repo switch.
Related errors
- branch_fetch_failed
- {err}
- Container reference not found
- result.error
- Force push required. The remote branch has diverged.
AI-assisted analysis of BloopAI/vibe-kanban@4deb7eca8f (2026-08-29).
Data as JSON: /api/errors/f54f5dcf78e58d99.
Report an issue: GitHub.