{"record":{"id":"8db9036d188702be","repo":"Hmbown/CodeWhale","slug":"current-codewhale-executable-path-is-not-valid-utf","errorCode":null,"errorMessage":"current Codewhale executable path is not valid UTF-8: {}","messagePattern":"current Codewhale executable path is not valid UTF-8: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/lib.rs","lineNumber":1353,"sourceCode":"    });\n    if let Some(token_budget) = token_budget {\n        payload[\"token_budget\"] = serde_json::json!(token_budget);\n    }\n    let input_json = serde_json::to_string(&payload)?;\n    let passthrough = vec![\n        \"workflow-tool\".to_string(),\n        \"--approval-source\".to_string(),\n        \"explicit-workflow-command\".to_string(),\n        \"--input-json\".to_string(),\n        input_json,\n    ];\n    let argv = {\n        // Build argv with explicit config path like the previous dispatcher did.\n        let mut args = Vec::new();\n        let executable = std::env::current_exe()\n            .context(\"resolve current Codewhale executable for workflow lane\")?;\n        let executable = executable.into_os_string().into_string().map_err(|path| {\n            anyhow!(\n                \"current Codewhale executable path is not valid UTF-8: {}\",\n                PathBuf::from(path).display()\n            )\n        })?;\n        args.push(executable);\n        // config_path is the explicit workflow config path; prefer it over cli.config\n        let cfg = Some(config_path);\n        if let Some(cp) = cfg {\n            args.push(\"--config\".to_string());\n            args.push(cp.display().to_string());\n        } else if let Some(cp) = cli.config.as_deref() {\n            args.push(\"--config\".to_string());\n            args.push(cp.display().to_string());\n        }\n        if let Some(profile) = cli.profile.as_ref() {\n            args.push(\"--profile\".to_string());\n            args.push(profile.clone());\n        }","sourceCodeStart":1335,"sourceCodeEnd":1371,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/cli/src/lib.rs#L1335-L1371","documentation":"When spawning a workflow lane as a child process, the CLI re-executes its own binary and requires std::env::current_exe() to yield a valid UTF-8 path, since argv is built from Strings. If the executable path contains non-UTF-8 bytes (OsString conversion fails), this error is thrown.","triggerScenarios":"The running binary lives at a path with non-UTF-8 bytes — e.g. a directory named with Latin-1/invalid bytes — and a workflow lane tries to spawn.","commonSituations":"Installing the CLI under a user or directory name containing unusual encodings, unusual mount points, or Windows paths with non-Unicode characters, then running a workflow.","solutions":["Move/install the Codewhale binary to an ASCII/UTF-8-only path (e.g. /usr/local/bin or ~/.local/bin)","Rename the offending directory segment to valid UTF-8","Invoke via a UTF-8-safe symlink on PATH","Report if your platform legitimately produces non-UTF-8 current_exe paths"],"exampleFix":"// before\n$ /opt/codewhale-latin1-büff/etc/codewhale workflow run\n// after\n$ sudo mv /opt/codewhale-latin1-büff/etc/codewhale /usr/local/bin/codewhale\n$ codewhale workflow run","handlingStrategy":"validation","validationCode":"let exe = std::env::current_exe()?;\nif std::str::from_utf8(exe.as_os_str().as_encoded_bytes()).is_err() {\n    eprintln!(\"Codewhale is installed at a non-UTF-8 path; reinstall under a UTF-8 path before using workflows\");\n}","typeGuard":"fn is_utf8_path(p: &std::path::Path) -> bool {\n    p.to_str().is_some()\n}","tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"not valid UTF-8\") => {\n        eprintln!(\"reinstall codewhale at a UTF-8-only path (e.g. /usr/local/bin)\");\n    }\n    other => other?,\n}","preventionTips":["Install the binary under an ASCII/UTF-8-only directory","Avoid non-Unicode directory names in install paths and mount points","Symlink from a clean PATH entry rather than invoking via exotic paths"],"tags":["encoding","utf-8","filesystem"],"backgroundTag":"invalid-argument-format","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}