{"record":{"id":"ed8279d77db5bda6","repo":"pbakaus/impeccable","slug":"build-phase-no-state-at-run-build-phase-mjs-s","errorCode":null,"errorMessage":"build-phase: no state at {}; run build-phase.mjs start --comp <approved comp>\n","messagePattern":"build-phase: no state at (.+?); run build-phase\\.mjs start --comp <approved comp>\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/comp-verbs/src/build_phase.rs","lineNumber":1861,"sourceCode":"            }\n        }\n        let existing = load_state(io);\n        if let Some(existing) = &existing {\n            if !flag(argv, \"reset\") {\n                io.out(&format!(\"build-phase: state exists (phase {}); pass --reset to start over\\n\", existing.get(\"phase\").and_then(Value::as_str).unwrap_or(\"\")));\n                io.out(&format!(\"{}\\n\", render_status(io, existing)));\n                return 0;\n            }\n        }\n        let state = new_state(comp, breakpoint.as_deref(), arg(argv, \"artifact\"), direction);\n        save_state(io, &state);\n        io.out(&format!(\"{}\\n\", render_status(io, &state)));\n        return 0;\n    }\n    let mut state = match load_state(io) {\n        Some(s) => s,\n        None => {\n            io.err(&format!(\"build-phase: no state at {}; run build-phase.mjs start --comp <approved comp>\\n\", state_path()));\n            return 1;\n        }\n    };\n    match cmd {\n        \"status\" => {\n            if flag(argv, \"json\") {\n                io.out(&format!(\"{}\\n\", util::json_pretty(&state)));\n            } else {\n                io.out(&format!(\"{}\\n\", render_status(io, &state)));\n            }\n            0\n        }\n        \"scaffold\" => {\n            let Some(spec) = load_spec(&abs(io, SPEC_PATH)) else {\n                io.err(&format!(\"build-phase: no spec at {SPEC_PATH}; run comp-spec.mjs first\\n\"));\n                return 1;\n            };\n            let out = write_scaffold(io, &spec);","sourceCodeStart":1843,"sourceCodeEnd":1879,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/crates/comp-verbs/src/build_phase.rs#L1843-L1879","documentation":"All build-phase subcommands other than `start` (status, advance, record, note, finish, etc.) require prior state created by `start`. load_state() returning None triggers this error naming the state file path, telling the user to run `build-phase.mjs start --comp <approved comp>` first, and exits 1.","triggerScenarios":"Running `impeccable build-phase status|advance|record|note|finish|scaffold` (anything after the status render path that calls load_state) when no build-phase has been started in this project, or when the state file at state_path() was deleted.","commonSituations":"Fresh clone or new machine where the .impeccable state was never created; accidentally deleting .impeccable/ state; running in the wrong repo/directory; a `start` invocation that failed before persisting state.","solutions":["Run `impeccable build-phase start --comp <approved comp png>` (or --direction <seed key>) to initialize state","Verify you are in the project directory that owns .impeccable/ state","Check the state file printed in the message exists and is valid JSON; restore from git if deleted"],"exampleFix":"// before\n$ impeccable build-phase advance\n// after\n$ impeccable build-phase start --comp comps/hero-approved.png\n$ impeccable build-phase advance","handlingStrategy":"validation","validationCode":"[ -f .impeccable/build-phase/state.json ] || { echo 'run build-phase start first'; exit 1; }\nimpeccable build-phase status","typeGuard":null,"tryCatchPattern":"impeccable build-phase status --json || impeccable build-phase start --comp \"$COMP\"","preventionTips":["Always run `build-phase start` before any other build-phase verb in a fresh checkout","Keep .impeccable/ state out of clean scripts","Verify cwd before running project-scoped stateful commands"],"tags":["cli","state","not-initialized"],"backgroundTag":"config-file-not-found","analyzedSha":"2bc2879276c1f321a53c4ca99d3371e411329b52","analyzedAt":"2026-09-08T04:51:14.109Z","contentChangedAt":"2026-09-08T04:51:14.109Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}