{"record":{"id":"02cb3b96a1e38e93","repo":"nikivdev/code","slug":"codex-skill-eval-launchd-install-failed","errorCode":null,"errorMessage":"codex skill-eval launchd install failed: {}","messagePattern":"codex skill-eval launchd install failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/ai.rs","lineNumber":9621,"sourceCode":"        .arg(script)\n        .arg(\"install\")\n        .arg(\"--minutes\")\n        .arg(minutes.to_string())\n        .arg(\"--limit\")\n        .arg(limit.to_string())\n        .arg(\"--max-targets\")\n        .arg(max_targets.to_string())\n        .arg(\"--within-hours\")\n        .arg(within_hours.to_string());\n    if dry_run {\n        command.arg(\"--dry-run\");\n    }\n    command.env(\"FLOW_CODEX_SKILL_EVAL_F_BIN\", current_exe);\n    let output = command\n        .output()\n        .context(\"failed to run codex skill-eval launchd installer\")?;\n    if !output.status.success() {\n        bail!(\n            \"codex skill-eval launchd install failed: {}\",\n            String::from_utf8_lossy(&output.stderr).trim()\n        );\n    }\n    Ok(String::from_utf8_lossy(&output.stdout).trim().to_string())\n}\n\nfn codex_enable_global(\n    dry_run: bool,\n    install_launchd: bool,\n    start_daemon: bool,\n    sync_skills: bool,\n    full: bool,\n    minutes: usize,\n    limit: usize,\n    max_targets: usize,\n    within_hours: u64,\n    provider: Provider,","sourceCodeStart":9603,"sourceCodeEnd":9639,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/ai.rs#L9603-L9639","documentation":"Flow installs a launchd job for the codex skill-eval daemon by shelling out to a helper installer binary (with FLOW_CODEX_SKILL_EVAL_F_BIN pointing at the current executable). If that subprocess exits with a non-zero status, Flow bubbles up its trimmed stderr with this error.","triggerScenarios":"Running `f codex enable-global` (or install-launchd / full setup) when the launchd installer subprocess fails — e.g. it cannot write to ~/Library/LaunchAgents, launchctl rejects the plist, or the installer binary itself errors.","commonSituations":"macOS permission issues (LaunchAgents directory not writable or protected), malformed plist due to unusual HOME, an outdated or mismatched installer binary after a Flow upgrade, launchctl failing in non-GUI/SSH sessions where the user's launchd domain is unavailable.","solutions":["Read the stderr text embedded in the error — it is the installer's own message and names the concrete failure.","Re-run the installer manually (the same command Flow invokes, with FLOW_CODEX_SKILL_EVAL_F_BIN set) to see full output.","Ensure ~/Library/LaunchAgents exists and is writable, and that launchctl is available (run inside a GUI session, not a bare SSH context).","Reinstall/update Flow so the installer helper matches the current version, then retry `f codex enable-global`."],"exampleFix":"// before\n$ f codex enable-global\nError: codex skill-eval launchd install failed: launchctl: could not bootstrap domain\n\n// after: fix environment, then verify\n$ mkdir -p ~/Library/LaunchAgents\n$ launchctl print gui/$(id -u) >/dev/null  # confirm launchd domain accessible\n$ f codex enable-global","handlingStrategy":"try-catch","validationCode":"use std::path::Path;\n// preflight before install:\nlet agents_dir = dirs::home_dir().map(|h| h.join(\"Library/LaunchAgents\"));\nlet writable = agents_dir\n    .as_deref()\n    .map(std::path::Path::is_dir)\n    .unwrap_or(false);\nassert!(writable, \"~/Library/LaunchAgents must exist and be writable\");","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"codex skill-eval launchd install failed\") => {\n        // e.to_string() embeds the installer's stderr; log it and inspect\n        // ~/Library/LaunchAgents permissions and launchctl availability before retrying.\n        eprintln!(\"launchd install failed: {e}\");\n    }\n    Err(e) => return Err(e),\n    Ok(out) => println!(\"installed: {out}\"),\n}","preventionTips":["Run install commands inside a GUI macOS session (launchctl user domains are limited over bare SSH).","Keep Flow and its installer helper binary in sync — reinstall after upgrades.","Confirm ~/Library/LaunchAgents exists and is writable before installing launchd jobs.","Capture and read the stderr embedded in the error; it names the concrete installer failure."],"tags":["rust","codex","launchd","macos","subprocess"],"backgroundTag":"launchd-install-failed","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}