{"record":{"id":"224666fae4d83c1e","repo":"BloopAI/vibe-kanban","slug":"container-ref-not-found-for-workspace","errorCode":null,"errorMessage":"Container ref not found for workspace","messagePattern":"Container ref not found for workspace","errorType":"exception","errorClass":"ContainerError","httpStatus":null,"severity":"error","filePath":"crates/local-deployment/src/container.rs","lineNumber":1326,"sourceCode":"                    return Ok(false);\n                }\n            }\n        }\n\n        Ok(true)\n    }\n\n    async fn start_execution_inner(\n        &self,\n        workspace: &Workspace,\n        execution_process: &ExecutionProcess,\n        executor_action: &ExecutorAction,\n    ) -> Result<(), ContainerError> {\n        // Get the worktree path\n        let container_ref = workspace\n            .container_ref\n            .as_ref()\n            .ok_or(ContainerError::Other(anyhow!(\n                \"Container ref not found for workspace\"\n            )))?;\n        let current_dir = PathBuf::from(container_ref);\n\n        let approvals_service: Arc<dyn ExecutorApprovalService> =\n            match executor_action.base_executor() {\n                Some(\n                    BaseCodingAgent::Codex\n                    | BaseCodingAgent::ClaudeCode\n                    | BaseCodingAgent::Gemini\n                    | BaseCodingAgent::QwenCode\n                    | BaseCodingAgent::Opencode,\n                ) => ExecutorApprovalBridge::new(\n                    self.approvals.clone(),\n                    self.db.clone(),\n                    self.notification_service.clone(),\n                    execution_process.id,\n                ),","sourceCodeStart":1308,"sourceCodeEnd":1344,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/crates/local-deployment/src/container.rs#L1308-L1344","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the workspace was fully created and its container_ref persisted before starting executions.","Reload the workspace from the database to get the current container_ref.","Call ensure_container_exists (which creates/attaches the container) before start_execution.","Recreate the workspace if its container record is permanently missing."],"exampleFix":"// before\ncontainer.start_execution(&workspace, &action, &process).await?;\n// after\nlet workspace = container.ensure_container_exists(workspace).await?; // sets container_ref\ncontainer.start_execution(&workspace, &action, &process).await?;","handlingStrategy":"validation","validationCode":"let workspace = get_workspace(ws_id).await?;\nif workspace.container_ref.is_none() {\n    return Err(anyhow!(\"workspace {ws_id} has no container; create it first\"));\n}","typeGuard":"fn has_container_ref(ws: &Workspace) -> bool {\n    ws.container_ref.as_deref().map(|s| !s.is_empty()).unwrap_or(false)\n}","tryCatchPattern":"match container.start_execution(&ws, &action, &proc).await {\n    Err(ContainerError::Other(e)) if e.to_string().contains(\"Container ref not found\") => {\n        let ws = container.ensure_container_exists(ws).await?;\n        container.start_execution(&ws, &action, &proc).await\n    }\n    other => other,\n}","preventionTips":["Always run ensure_container_exists before starting executions.","Reload the workspace from DB rather than reusing stale in-memory copies.","Block execution start for workspaces still marked creating/incomplete.","Check for container_ref in the UI before enabling run buttons."],"tags":["workspace","container","precondition"],"backgroundTag":"missing-container-reference","analyzedSha":"4deb7eca8f381f7cbc1f9d15515a9ab8f8009053","analyzedAt":"2026-08-29T09:24:13.446Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}