{"record":{"id":"0df9966624e8b0e5","repo":"nikivdev/code","slug":"codex-doctor-assertion-failed-next-run-f-c","errorCode":null,"errorMessage":"codex doctor assertion failed:\n- {}\nnext: run `f codex enable-global --full`, then exercise `f codex open ...` or `f ai codex new` through Flow until outcomes appear","messagePattern":"codex doctor assertion failed:\n- (.+?)\nnext: run `f codex enable-global --full`, then exercise `f codex open \\.\\.\\.` or `f ai codex new` through Flow until outcomes appear","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/ai.rs","lineNumber":8909,"sourceCode":"        if snapshot.skill_eval_events_on_disk == 0 {\n            failures.push(\"no Codex route events recorded yet\".to_string());\n        }\n        if snapshot.skill_scorecard_entries == 0 {\n            failures.push(\"no skill scorecard entries built yet\".to_string());\n        }\n        if snapshot.skill_eval_outcomes_on_disk == 0 {\n            failures.push(\n                \"no grounded skill outcome events recorded yet; the system is still affinity-only\"\n                    .to_string(),\n            );\n        }\n    }\n\n    if failures.is_empty() {\n        return Ok(());\n    }\n\n    bail!(\n        \"codex doctor assertion failed:\\n- {}\\nnext: run `f codex enable-global --full`, then exercise `f codex open ...` or `f ai codex new` through Flow until outcomes appear\",\n        failures.join(\"\\n- \")\n    )\n}\n\nfn codex_daemon_env_usize(primary: &str, legacy: &str) -> Option<usize> {\n    std::env::var(primary)\n        .ok()\n        .or_else(|| std::env::var(legacy).ok())\n        .and_then(|value| value.parse::<usize>().ok())\n}\n\nfn codex_daemon_env_u64(primary: &str, legacy: &str) -> Option<u64> {\n    std::env::var(primary)\n        .ok()\n        .or_else(|| std::env::var(legacy).ok())\n        .and_then(|value| value.parse::<u64>().ok())\n}","sourceCodeStart":8891,"sourceCodeEnd":8927,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/ai.rs#L8891-L8927","documentation":"The `codex doctor` command runs a set of assertions about the local Codex integration (global install/enablement, daemon state, etc.) and aggregates failures. If any assertion fails, it bails with a formatted report of the failed checks plus a suggested remediation workflow: fully enabling Codex globally and exercising `f codex open ...` or `f ai codex new` through Flow until outcome records appear.","triggerScenarios":"Running `f codex doctor` when one or more checks fail — e.g. Codex global config not fully enabled, daemon not reachable or misconfigured, or no recorded Codex outcomes because the integration has never been exercised.","commonSituations":"Fresh machine setup where `f codex enable-global` was never run or was run without `--full`; daemon env values (ports/timeouts) misconfigured; a user runs doctor before ever opening a Codex session so no outcomes exist yet.","solutions":["Run `f codex enable-global --full` to fully enable the Codex integration","Exercise the integration: `f codex open ...` or `f ai codex new` so outcome records are produced","Re-run `f codex doctor` to confirm all assertions pass","If checks still fail, inspect daemon environment settings (ports, timeouts) and ensure the Codex daemon is running"],"exampleFix":"// before\n$ f codex doctor\nerror: codex doctor assertion failed:\n- no codex outcomes recorded\n// after\n$ f codex enable-global --full\n$ f codex open .\n$ f codex doctor\nok","handlingStrategy":"validation","validationCode":"// Shell: pre-check before relying on doctor passing\nf codex doctor || { f codex enable-global --full; f codex open .; f codex doctor; }","typeGuard":"fn codex_ready(doctor_output: &str) -> bool {\n    !doctor_output.contains(\"assertion failed\")\n}","tryCatchPattern":"match codex_doctor() {\n    Ok(()) => (),\n    Err(e) if e.to_string().starts_with(\"codex doctor assertion failed\") => {\n        let report = e.to_string();\n        eprintln!(\"{report}\");\n        eprintln!(\"Remediation: f codex enable-global --full, then f codex open ...\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Run `f codex enable-global --full` during machine setup before using Codex features","Exercise `f codex open ...` / `f ai codex new` at least once so outcome records exist","Run `f codex doctor` as part of your environment sanity checks, not as a first-time setup step"],"tags":["codex","doctor","environment-setup","daemon"],"backgroundTag":"environment-not-initialized","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}