{"record":{"id":"117c77a4a3429b89","repo":"pbakaus/impeccable","slug":"impeccable-live-msg","errorCode":null,"errorMessage":"[impeccable live] {msg}\n","messagePattern":"\\[impeccable live\\] (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/live/src/roots.rs","lineNumber":491,"sourceCode":"            }\n            let v = v.to_string();\n            argv.remove(i);\n            return Ok(Some(v));\n        }\n        i += 1;\n    }\n    Ok(None)\n}\n\n/// JS: enterLiveRoot(cwd). Consumes `--target` from `args`, resolves the\n/// governing roots, and moves `io.cwd` onto the appRoot. `Err(code)` means\n/// the process must exit with that code (the message is already on stderr);\n/// `Ok(None)` is the selection-ambiguity case (stay put).\npub fn enter_live_root(args: &mut Vec<String>, io: &mut Io) -> Result<Option<RootsManifest>, i32> {\n    let target = match consume_target_arg(args) {\n        Ok(t) => t,\n        Err(msg) => {\n            io.err(&format!(\"[impeccable live] {}\\n\", msg));\n            return Err(1);\n        }\n    };\n    let cwd = io.cwd.to_string_lossy().into_owned();\n    let resolved = resolve_live_roots(&cwd, target.as_deref(), io);\n    let Some(manifest) = resolved.manifest else {\n        return Ok(None);\n    };\n    let app_root = manifest.app_root.clone();\n    if jsp::resolve(&cwd, &[]) != jsp::resolve(&app_root, &[]) {\n        if !is_dir(&app_root) {\n            io.err(&format!(\n                \"[impeccable live] resolved app root does not exist: {} (stale roots manifest? re-run the live boot, or pass --target <path>)\\n\",\n                app_root\n            ));\n            return Err(1);\n        }\n        io.cwd = std::path::PathBuf::from(&app_root);","sourceCodeStart":473,"sourceCodeEnd":509,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/crates/live/src/roots.rs#L473-L509","documentation":"`enter_live_root` validates the `--target` argument consumed from the CLI args before booting live mode. If `consume_target_arg` returns an error (missing or malformed target), the message is printed with the `[impeccable live]` prefix and the process exits with code 1. It is a CLI usage error, not a runtime failure.","triggerScenarios":"Running `impeccable live` with a `--target` value that fails target-argument validation — e.g. an empty `--target`, an unexpected extra positional argument, or a value that cannot be resolved to a live root.","commonSituations":"Typos like `--target=` with no value; passing a flag where a path is expected; scripting the command with a variable that expands to empty; copying a command example that uses an unsupported target form.","solutions":["Re-run with a valid explicit target: `impeccable live --target ./path-to-app`.","Run `impeccable live --help` to see accepted target argument forms.","If a shell variable supplies the path, quote it and verify it is non-empty: `echo \"$TARGET\"`.","Run from the project/app directory and omit `--target` to use auto-detection."],"exampleFix":"// before\nimpeccable live --target=\n// after\nimpeccable live --target ./webapp\n","handlingStrategy":"validation","validationCode":"[ -n \"$TARGET\" ] && [ -d \"$TARGET\" ] && impeccable live --target \"$TARGET\" || echo 'TARGET must be a non-empty existing path'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always quote --target values in scripts so empty variables are caught early.","Verify the target path exists before passing it.","Check `impeccable live --help` for the accepted target format."],"tags":["cli","argument-validation","live-mode"],"backgroundTag":"invalid-cli-argument","analyzedSha":"2bc2879276c1f321a53c4ca99d3371e411329b52","analyzedAt":"2026-09-08T04:51:14.109Z","contentChangedAt":"2026-09-08T04:51:14.109Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}