BloopAI/vibe-kanban · error · ContainerError

Container reference not found

Error message

Container reference not found

What it means

In try_commit_changes, the code reads ctx.workspace.container_ref and errors out if it is None. container_ref is the filesystem path of the workspace container; local deployments always set it, so None means the workspace record lacks a valid container reference. The commit of pending changes cannot proceed without a path to inspect git repositories.

Source

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

        // Merge all streams into one
        Ok(Box::pin(futures::stream::select_all(streams)))
    }

    async fn try_commit_changes(&self, ctx: &ExecutionContext) -> Result<bool, ContainerError> {
        if !matches!(
            ctx.execution_process.run_reason,
            ExecutionProcessRunReason::CodingAgent | ExecutionProcessRunReason::CleanupScript,
        ) {
            return Ok(false);
        }

        let message = self.get_commit_message(ctx).await;

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

        let repos_with_changes = self.check_repos_for_changes(&workspace_root, &ctx.repos)?;
        if repos_with_changes.is_empty() {
            tracing::debug!("No changes to commit in any repository");
            return Ok(false);
        }

        Ok(self.commit_repos(repos_with_changes, &message))
    }

    /// Copy files from the original project directory to the worktree.
    /// Skips files that already exist at target with same size.
    async fn copy_project_files(
        &self,
        source_dir: &Path,
        target_dir: &Path,
        copy_files: &str,

View on GitHub (pinned to 4deb7eca8f)

Solutions

  1. Verify the workspace row in the DB has container_ref set; re-create or re-attach the workspace so the container is provisioned.
  2. Ensure the container/workspace startup flow completed before triggering commit (don't call try_commit_changes for never-started workspaces).
  3. Check for migrations or cleanup jobs that null out container_ref and restore the correct path.
  4. Guard the call site: skip committing when ctx.workspace.container_ref is None.

Example fix

// before
let container_ref = ctx.workspace.container_ref.as_ref().ok_or_else(...)?;
// after
if ctx.workspace.container_ref.is_none() {
    tracing::warn!(workspace_id = %ctx.workspace.id, "no container_ref; skipping commit");
    return Ok(false);
}
let container_ref = ctx.workspace.container_ref.as_ref().unwrap();
Defensive patterns

Strategy: validation

Validate before calling

if ctx.workspace.container_ref.is_none() {
    return Err(anyhow!("workspace {} has no container_ref; start the container first", ctx.workspace.id));
}

Type guard

fn has_container_ref(ctx: &Context) -> bool {
    ctx.workspace.container_ref.as_deref().map(|p| !p.is_empty()).unwrap_or(false)
}

Try / catch

match try_commit_changes(ctx).await {
    Err(ContainerError::Other(e)) if e.to_string().contains("Container reference not found") => {
        tracing::warn!("skipping commit: no container ref");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling try_commit_changes (via spawn_exit_monitor) for a workspace whose container_ref field is null/None in the database, or a workspace created without a container ever being started/registered.

Common situations: Workspaces created by a remote/different deployment context being committed locally; corrupted or partially-migrated DB rows; trying to commit after a container was deleted; workspace creation failed midway so container_ref was never populated.

Related errors


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