{"record":{"id":"39e2d516987cd84d","repo":"nikivdev/code","slug":"handled-before-project-context-load","errorCode":null,"errorMessage":"handled before project context load","messagePattern":"handled before project context load","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/deploy.rs","lineNumber":417,"sourceCode":"            lines,\n        }) => show_logs(\n            &project_root,\n            flow_config.as_ref(),\n            follow,\n            since_deploy,\n            all,\n            lines,\n        ),\n        Some(DeployAction::Restart) => restart_service(&project_root, flow_config.as_ref()),\n        Some(DeployAction::Stop) => stop_service(&project_root, flow_config.as_ref()),\n        Some(DeployAction::Health { url, status }) => {\n            check_health(&project_root, flow_config.as_ref(), url, status)\n        }\n        Some(DeployAction::Config)\n        | Some(DeployAction::Release(_))\n        | Some(DeployAction::Shell)\n        | Some(DeployAction::SetHost { .. })\n        | Some(DeployAction::ShowHost) => unreachable!(\"handled before project context load\"),\n    }\n}\n\n/// Run a production deploy (skips flow.deploy_task and prefers deploy-prod/prod tasks).\npub fn run_prod(cmd: DeployCommand) -> Result<()> {\n    match cmd.action {\n        Some(DeployAction::Config) => configure_deploy(),\n        Some(DeployAction::Release(opts)) => release::run_task(opts),\n        Some(DeployAction::Shell) => open_shell(),\n        Some(DeployAction::SetHost { connection }) => set_host(&connection),\n        Some(DeployAction::ShowHost) => show_host(),\n        action => {\n            let ctx = load_deploy_project_context()?;\n            run_prod_with_project_context(action, ctx)\n        }\n    }\n}\n","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/deploy.rs#L399-L435","documentation":"build_web_ui in src/web.rs builds the bundled web UI whenever .ai/web/package.json exists in the project. Before building it checks that the `bun` executable is on PATH via the `which` crate; if not, it bails with this message. The build deliberately hard-requires bun (it uses bun.lock and bun install), so it fails fast rather than attempting a partial build.","triggerScenarios":"Running the flow command whose run() path calls build_web_ui when a project contains .ai/web/package.json but `bun` is not installed or not on PATH (e.g. PATH missing ~/.bun/bin, CI image without bun).","commonSituations":"Fresh machines or Docker images without bun installed; users who cloned a repo that ships a .ai/web frontend but never installed bun; PATH configured for node/npm but not bun; running the tool from an environment (cron, IDE launcher) with a stripped PATH.","solutions":["Install bun (curl -fsSL https://bun.sh/install | bash) and ensure ~/.bun/bin is on PATH.","Remove or rename .ai/web/package.json if you do not need the bundled web UI; build_web_ui then skips the build entirely.","Verify with `which bun`; if it prints nothing, fix PATH before running flow."],"exampleFix":"// before (CI without bun)\n- run: cargo run -- flow serve\n// after\n+ run: |\n+   curl -fsSL https://bun.sh/install | bash\n+   echo \"$HOME/.bun/bin\" >> \"$GITHUB_PATH\"\n+   cargo run -- flow serve","handlingStrategy":"validation","validationCode":"if !std::path::Path::new(\".ai/web/package.json\").exists() { /* ok: build skipped */ }\nelse if which::which(\"bun\").is_err() {\n    eprintln!(\"install bun first: curl -fsSL https://bun.sh/install | bash\");\n}","typeGuard":"fn bun_available() -> bool { which::which(\"bun\").is_ok() }","tryCatchPattern":"match flow::web::build_result {\n    Err(e) if e.to_string().contains(\"bun is required\") => install_bun_and_retry(),\n    Err(e) => return Err(e),\n    Ok(v) => v,\n}","preventionTips":["Install bun in your dev image/Dockerfile and add ~/.bun/bin to PATH.","Remove .ai/web/package.json if you never use the bundled web UI.","Run `which bun` as a pre-flight check in CI before invoking flow."],"tags":["build","missing-binary","bun","path"],"backgroundTag":"required-executable-not-on-path","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}