{"record":{"id":"8b76ff3bbebddb86","repo":"BloopAI/vibe-kanban","slug":"container-ref-not-found","errorCode":null,"errorMessage":"Container ref not found","messagePattern":"Container ref not found","errorType":"exception","errorClass":"ContainerError","httpStatus":null,"severity":"error","filePath":"crates/services/src/services/container.rs","lineNumber":1154,"sourceCode":"        session: &Session,\n        executor_action: &ExecutorAction,\n        run_reason: &ExecutionProcessRunReason,\n    ) -> Result<ExecutionProcess, ContainerError> {\n        // Create new execution process record\n        // Capture current HEAD per repository as the \"before\" commit for this execution\n        let repositories =\n            WorkspaceRepo::find_repos_for_workspace(&self.db().pool, workspace.id).await?;\n        if repositories.is_empty() {\n            return Err(ContainerError::Other(anyhow!(\n                \"Workspace has no repositories configured\"\n            )));\n        }\n\n        let workspace_root = workspace\n            .container_ref\n            .as_ref()\n            .map(std::path::PathBuf::from)\n            .ok_or_else(|| ContainerError::Other(anyhow!(\"Container ref not found\")))?;\n\n        let mut repo_states = Vec::with_capacity(repositories.len());\n        for repo in &repositories {\n            let repo_path = workspace_root.join(&repo.name);\n            let before_head_commit = self.git().get_head_info(&repo_path).ok().map(|h| h.oid);\n            repo_states.push(CreateExecutionProcessRepoState {\n                repo_id: repo.id,\n                before_head_commit,\n                after_head_commit: None,\n                merge_commit: None,\n            });\n        }\n        let create_execution_process = CreateExecutionProcess {\n            session_id: session.id,\n            executor_action: executor_action.clone(),\n            run_reason: run_reason.clone(),\n        };\n","sourceCodeStart":1136,"sourceCodeEnd":1172,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/crates/services/src/services/container.rs#L1136-L1172","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Wait for workspace initialization to complete and confirm container_ref is set before starting executions.","Inspect the workspaces row (SELECT container_ref FROM workspaces WHERE id = ...) to verify the path is populated.","Retry workspace creation / setup if the container failed to materialize on disk.","Check that the container creation step succeeded (logs for Docker/FS errors) before re-triggering execution."],"exampleFix":"// before\nlet process = container.start_execution(&workspace, cmd, ...).await?;\n// after\nif workspace.container_ref.is_none() {\n    anyhow::bail!(\"workspace {} not initialized yet\", workspace.id);\n}\nlet process = container.start_execution(&workspace, cmd, ...).await?;","handlingStrategy":"validation","validationCode":"if workspace.container_ref.as_deref().map_or(true, |p| !Path::new(p).is_dir()) {\n    anyhow::bail!(\"workspace {} container not ready on disk\", workspace.id);\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = start_execution(&workspace, ...).await {\n    if e.to_string().contains(\"Container ref not found\") {\n        reinitialize_workspace(&workspace).await?;\n    } else { return Err(e); }\n}","preventionTips":["Wait for the workspace-created/initialized event before issuing executions.","After a failed container setup, retry creation instead of queuing executions.","Treat NULL container_ref as 'not ready' in application logic."],"tags":["workspace","initialization","null-field"],"backgroundTag":"workspace-not-initialized","analyzedSha":"4deb7eca8f381f7cbc1f9d15515a9ab8f8009053","analyzedAt":"2026-08-29T09:24:13.446Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}