BloopAI/vibe-kanban · error · ContainerError

Container ref not found for workspace

Error message

Container ref not found for workspace

What it means

start_execution_inner requires the workspace to have a container_ref (the worktree directory path) and throws this error when workspace.container_ref is None. Without a container ref there is no working directory in which to spawn the executor process. It is a precondition check on the workspace record.

Source

Thrown at crates/local-deployment/src/container.rs:1326

                    return Ok(false);
                }
            }
        }

        Ok(true)
    }

    async fn start_execution_inner(
        &self,
        workspace: &Workspace,
        execution_process: &ExecutionProcess,
        executor_action: &ExecutorAction,
    ) -> Result<(), ContainerError> {
        // Get the worktree path
        let container_ref = workspace
            .container_ref
            .as_ref()
            .ok_or(ContainerError::Other(anyhow!(
                "Container ref not found for workspace"
            )))?;
        let current_dir = PathBuf::from(container_ref);

        let approvals_service: Arc<dyn ExecutorApprovalService> =
            match executor_action.base_executor() {
                Some(
                    BaseCodingAgent::Codex
                    | BaseCodingAgent::ClaudeCode
                    | BaseCodingAgent::Gemini
                    | BaseCodingAgent::QwenCode
                    | BaseCodingAgent::Opencode,
                ) => ExecutorApprovalBridge::new(
                    self.approvals.clone(),
                    self.db.clone(),
                    self.notification_service.clone(),
                    execution_process.id,
                ),

View on GitHub (pinned to 4deb7eca8f)

Solutions

  1. Verify the workspace was fully created and its container_ref persisted before starting executions.
  2. Reload the workspace from the database to get the current container_ref.
  3. Call ensure_container_exists (which creates/attaches the container) before start_execution.
  4. Recreate the workspace if its container record is permanently missing.

Example fix

// before
container.start_execution(&workspace, &action, &process).await?;
// after
let workspace = container.ensure_container_exists(workspace).await?; // sets container_ref
container.start_execution(&workspace, &action, &process).await?;
Defensive patterns

Strategy: validation

Validate before calling

let workspace = get_workspace(ws_id).await?;
if workspace.container_ref.is_none() {
    return Err(anyhow!("workspace {ws_id} has no container; create it first"));
}

Type guard

fn has_container_ref(ws: &Workspace) -> bool {
    ws.container_ref.as_deref().map(|s| !s.is_empty()).unwrap_or(false)
}

Try / catch

match container.start_execution(&ws, &action, &proc).await {
    Err(ContainerError::Other(e)) if e.to_string().contains("Container ref not found") => {
        let ws = container.ensure_container_exists(ws).await?;
        container.start_execution(&ws, &action, &proc).await
    }
    other => other,
}

Prevention

When it happens

Trigger: Calling start_execution with a workspace whose container_ref was never set (creation incomplete), was cleared, or whose workspace record was deserialized from a state that omits it.

Common situations: Starting an execution on a workspace that failed creation partway (PartialCreation path); using a stale workspace object loaded before the container was created; archiving/deleting the workspace then referencing it.

Related errors


AI-assisted analysis of BloopAI/vibe-kanban@4deb7eca8f (2026-08-29). Data as JSON: /api/errors/224666fae4d83c1e. Report an issue: GitHub.