{"record":{"id":"5f01fbbce4c8d6d9","repo":"nikivdev/code","slug":"flow-codex-wrapper-is-missing-at-build-or-sync","errorCode":null,"errorMessage":"Flow Codex wrapper is missing at {}; build or sync Flow first","messagePattern":"Flow Codex wrapper is missing at (.+?); build or sync Flow first","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/ai.rs","lineNumber":9513,"sourceCode":"    let temp = parent.join(format!(\n        \".{}.tmp-{}-{}\",\n        path.file_name()\n            .and_then(|value| value.to_str())\n            .unwrap_or(\"flow.toml\"),\n        std::process::id(),\n        unix_now_secs()\n    ));\n    fs::write(&temp, content).with_context(|| format!(\"failed to write {}\", temp.display()))?;\n    fs::rename(&temp, path).with_context(|| format!(\"failed to replace {}\", path.display()))?;\n    Ok(())\n}\n\nfn upsert_global_codex_config(path: &Path) -> Result<(String, bool, bool, bool)> {\n    let mut root = parse_global_flow_toml(path)?;\n    let created = !path.exists();\n    let wrapper_path = config::expand_path(DEFAULT_GLOBAL_CODEX_WRAPPER_BIN);\n    if !wrapper_path.exists() {\n        bail!(\n            \"Flow Codex wrapper is missing at {}; build or sync Flow first\",\n            wrapper_path.display()\n        );\n    }\n\n    let codex = ensure_toml_table(&mut root, \"codex\")?;\n    codex.insert(\"runtime_skills\".to_string(), TomlValue::Boolean(true));\n    codex.insert(\n        \"auto_resolve_references\".to_string(),\n        TomlValue::Boolean(true),\n    );\n    codex\n        .entry(\"home_session_path\".to_string())\n        .or_insert_with(|| TomlValue::String(DEFAULT_GLOBAL_CODEX_HOME_SESSION_PATH.to_string()));\n    codex\n        .entry(\"prompt_context_budget_chars\".to_string())\n        .or_insert_with(|| TomlValue::Integer(DEFAULT_GLOBAL_CODEX_PROMPT_BUDGET as i64));\n    codex","sourceCodeStart":9495,"sourceCodeEnd":9531,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/ai.rs#L9495-L9531","documentation":"Flow manages a global Codex configuration by writing a `codex` table into the user's global config TOML, and it references a wrapper binary (DEFAULT_GLOBAL_CODEX_WRAPPER_BIN) that must exist on disk. Before modifying the config, upsert_global_codex_config verifies the wrapper binary exists; if it does not, it aborts with this error rather than writing a config that points at a nonexistent binary.","triggerScenarios":"Calling any Flow command that upserts the global Codex config (e.g. `f codex enable-global`, `full` setup) when the expanded wrapper path (typically under ~/.local/... or the Flow install dir) does not exist because Flow was never built/synced or the binary was deleted.","commonSituations":"Fresh machine setup where `f codex sync`/build was skipped; wrapper removed by cleanup scripts or after upgrading the Flow install location; PATH/HOME differences (e.g. running under a different user or CI) making expand_path resolve to a different directory.","solutions":["Build or sync Flow so the wrapper binary is produced at the expected path (e.g. run `f codex sync` or rebuild the Flow binary per the README).","Check the path printed in the error message and confirm whether the file exists there (ls the directory).","If Flow was moved or HOME changed, reinstall Flow so expand_path(DEFAULT_GLOBAL_CODEX_WRAPPER_BIN) resolves to the real binary location."],"exampleFix":"// before: running enable-global on a fresh machine\n$ f codex enable-global\nError: Flow Codex wrapper is missing at ~/.local/bin/f-codex-wrapper; build or sync Flow first\n\n// after: build/sync Flow first\n$ f codex sync   # or: cargo build --release && f codex sync\n$ f codex enable-global","handlingStrategy":"validation","validationCode":"use std::path::Path;\nfn wrapper_exists(expanded_wrapper: &Path) -> bool {\n    expanded_wrapper.is_file()\n}\n// call before running any command that syncs the global codex config:\n// assert!(wrapper_exists(&expanded_wrapper_path), \"build/sync Flow first\");","typeGuard":"fn is_existing_file(p: &std::path::Path) -> bool {\n    p.is_file()\n}","tryCatchPattern":null,"preventionTips":["Run `f codex sync` (or build) right after installing Flow and before any enable-global/full setup.","Add a preflight check for the wrapper binary in setup scripts using the path reported in the error.","Re-sync after moving the Flow install or changing HOME so expand_path still resolves the binary."],"tags":["rust","codex","missing-binary","setup"],"backgroundTag":"missing-binary-artifact","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}