{"record":{"id":"a56b5557adee9f52","repo":"BloopAI/vibe-kanban","slug":"opencode-startup-error-err","errorCode":null,"errorMessage":"OpenCode startup error: {err}","messagePattern":"OpenCode startup error: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/executors/src/executors/opencode.rs","lineNumber":204,"sourceCode":"        let model = self.model.clone();\n        let model_variant = self.variant.clone();\n        let agent = self.agent.clone();\n        let auto_approve = self.auto_approve;\n        let resume_session_id = resume_session.map(|s| s.to_string());\n        let models_cache_key = self.compute_models_cache_key();\n        let cancel_for_task = cancel.clone();\n        let commit_reminder = env.commit_reminder;\n        let commit_reminder_prompt = env.commit_reminder_prompt.clone();\n        let repo_context = env.repo_context.clone();\n\n        tokio::spawn(async move {\n            // Wait for server to print listening URL\n            let base_url = match wait_for_server_url(server_stdout, Some(log_writer.clone())).await\n            {\n                Ok(url) => url,\n                Err(err) => {\n                    let _ = log_writer\n                        .log_error(format!(\"OpenCode startup error: {err}\"))\n                        .await;\n                    let _ = exit_signal_tx.send(ExecutorExitResult::Failure);\n                    return;\n                }\n            };\n\n            let config = RunConfig {\n                base_url,\n                directory,\n                prompt: combined_prompt,\n                resume_session_id,\n                model,\n                model_variant,\n                agent,\n                approvals,\n                auto_approve,\n                server_password,\n                models_cache_key,","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/crates/executors/src/executors/opencode.rs#L186-L222","documentation":"In the OpenCode executor's spawn_inner, wait_for_server_url reads the spawned `opencode serve` process's stdout to capture the listening URL. If the server fails to print a valid URL (timeout, crash, or unexpected output), the error is written to the execution log as \"OpenCode startup error: {err}\" and the task exits with ExecutorExitResult::Failure. The executor never reaches the prompt-running stage.","triggerScenarios":"wait_for_server_url returns Err when the opencode server process exits early, times out before printing its listening URL, or prints output that doesn't parse as a URL — reached via spawn or spawn_follow_up.","commonSituations":"OpenCode CLI not installed or wrong version on PATH; opencode fails at startup due to bad config or missing authentication for a provider; port binding conflicts; the process crashes immediately (e.g. unsupported platform or corrupted install); slow startup exceeding the wait timeout.","solutions":["Read the full task log to see the underlying error detail after 'OpenCode startup error:' and fix that root cause.","Verify the opencode CLI is installed and works: run `opencode --version` (and `opencode serve` manually) in the workspace directory.","Check the opencode config/auth (~/.config/opencode or project config) and provider API keys for validity.","Upgrade or reinstall opencode to a compatible version; ensure no other process occupies the port it tries to bind.","Increase tolerance for slow startup (machine resource limits) or disable conflicting env/profile overrides passed via ExecutionEnv."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// before spawning, verify the CLI is available\nlet out = Command::new(\"opencode\").arg(\"--version\").output()?;\nif !out.status.success() {\n    return Err(\"opencode CLI missing or not executable; install a compatible version\".into());\n}","typeGuard":null,"tryCatchPattern":"match wait_for_server_url(stdout, Some(log_writer)).await {\n    Ok(url) => url,\n    Err(err) => {\n      log_error(format!(\"OpenCode startup error: {err}\"));\n      // surface err to the user and offer a retry of the task attempt\n      return;\n    }\n}","preventionTips":["Pin and verify the opencode CLI version in your environment/image before running tasks.","Keep opencode config and provider auth valid; test `opencode serve` manually.","Avoid port conflicts on the machine where tasks execute.","Check task logs immediately when an attempt fails at startup — the root cause follows this message.","Provision adequate CPU/memory so the server starts within the timeout."],"tags":["opencode","process-spawn","startup","executor"],"backgroundTag":"dev-server-failed-to-start","analyzedSha":"4deb7eca8f381f7cbc1f9d15515a9ab8f8009053","analyzedAt":"2026-08-29T09:24:13.446Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}