BloopAI/vibe-kanban · error · ContainerError

Container ref not found

Error message

Container ref not found

What it means

start_execution needs the workspace's container_ref (its on-disk directory path) to locate each repo and capture HEAD info. This error is thrown when the workspace's container_ref column is NULL, meaning the workspace has never been materialized on disk (container not yet created or creation failed).

Solutions

  1. Wait for workspace initialization to complete and confirm container_ref is set before starting executions.
  2. Inspect the workspaces row (SELECT container_ref FROM workspaces WHERE id = ...) to verify the path is populated.
  3. Retry workspace creation / setup if the container failed to materialize on disk.
  4. Check that the container creation step succeeded (logs for Docker/FS errors) before re-triggering execution.

Example fix

// before
let process = container.start_execution(&workspace, cmd, ...).await?;
// after
if workspace.container_ref.is_none() {
    anyhow::bail!("workspace {} not initialized yet", workspace.id);
}
let process = container.start_execution(&workspace, cmd, ...).await?;
Defensive patterns

Strategy: validation

Validate before calling

if workspace.container_ref.as_deref().map_or(true, |p| !Path::new(p).is_dir()) {
    anyhow::bail!("workspace {} container not ready on disk", workspace.id);
}

Try / catch

if let Err(e) = start_execution(&workspace, ...).await {
    if e.to_string().contains("Container ref not found") {
        reinitialize_workspace(&workspace).await?;
    } else { return Err(e); }
}

Prevention

When it happens

Trigger: Calling start_execution (directly or via follow_up/start_review/run_setup_script/run_codex_setup/run_cursor_setup) on a workspace whose container_ref is NULL — e.g. before workspace initialization finished, or after it failed.

Common situations: Submitting a follow-up while workspace creation is still in progress; container creation failed earlier (disk, Docker, path error) leaving a NULL ref; DB rows created but setup aborted; race between workspace creation UI and immediate execution.

Related errors


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

Appendix: source

Thrown at crates/services/src/services/container.rs:1154

        session: &Session,
        executor_action: &ExecutorAction,
        run_reason: &ExecutionProcessRunReason,
    ) -> Result<ExecutionProcess, ContainerError> {
        // Create new execution process record
        // Capture current HEAD per repository as the "before" commit for this execution
        let repositories =
            WorkspaceRepo::find_repos_for_workspace(&self.db().pool, workspace.id).await?;
        if repositories.is_empty() {
            return Err(ContainerError::Other(anyhow!(
                "Workspace has no repositories configured"
            )));
        }

        let workspace_root = workspace
            .container_ref
            .as_ref()
            .map(std::path::PathBuf::from)
            .ok_or_else(|| ContainerError::Other(anyhow!("Container ref not found")))?;

        let mut repo_states = Vec::with_capacity(repositories.len());
        for repo in &repositories {
            let repo_path = workspace_root.join(&repo.name);
            let before_head_commit = self.git().get_head_info(&repo_path).ok().map(|h| h.oid);
            repo_states.push(CreateExecutionProcessRepoState {
                repo_id: repo.id,
                before_head_commit,
                after_head_commit: None,
                merge_commit: None,
            });
        }
        let create_execution_process = CreateExecutionProcess {
            session_id: session.id,
            executor_action: executor_action.clone(),
            run_reason: run_reason.clone(),
        };

View on GitHub (pinned to 4deb7eca8f)