Hmbown/CodeWhale · error · anyhow::Error

current Codewhale executable path is not valid UTF-8: {}

Error message

current Codewhale executable path is not valid UTF-8: {}

What it means

Workflow-lane dispatch re-executes the current binary as `codewhale workflow-tool ...`, building argv as UTF-8 Strings. If the current executable's path contains non-UTF-8 bytes, into_string() fails and this error aborts the workflow lane before spawning. It is an environment/install-location defect, not workflow logic.

Source

Thrown at crates/cli/src/lib.rs:1297

    });
    if let Some(token_budget) = token_budget {
        payload["token_budget"] = serde_json::json!(token_budget);
    }
    let input_json = serde_json::to_string(&payload)?;
    let passthrough = vec![
        "workflow-tool".to_string(),
        "--approval-source".to_string(),
        "explicit-workflow-command".to_string(),
        "--input-json".to_string(),
        input_json,
    ];
    let argv = {
        // Build argv with explicit config path like the previous dispatcher did.
        let mut args = Vec::new();
        let executable = std::env::current_exe()
            .context("resolve current Codewhale executable for workflow lane")?;
        let executable = executable.into_os_string().into_string().map_err(|path| {
            anyhow!(
                "current Codewhale executable path is not valid UTF-8: {}",
                PathBuf::from(path).display()
            )
        })?;
        args.push(executable);
        // config_path is the explicit workflow config path; prefer it over cli.config
        let cfg = Some(config_path);
        if let Some(cp) = cfg {
            args.push("--config".to_string());
            args.push(cp.display().to_string());
        } else if let Some(cp) = cli.config.as_deref() {
            args.push("--config".to_string());
            args.push(cp.display().to_string());
        }
        if let Some(profile) = cli.profile.as_ref() {
            args.push("--profile".to_string());
            args.push(profile.clone());
        }

View on GitHub (pinned to 8880682c63)

Solutions

  1. Reinstall or move the binary to a plain ASCII path (e.g. ~/.local/bin/codewhale)
  2. Remove/rename non-UTF-8 directories from the install path
  3. Check the shell/locale environment if the path looks normal but still fails

Example fix

# before
 /home/user/\udcffbin/codewhale workflow run   # error: non-UTF-8 executable path

# after
 mv /home/user/\udcffbin/codewhale ~/.local/bin/codewhale 
 ~/.local/bin/codewhale workflow run
Defensive patterns

Strategy: validation

Validate before calling

fn codewhale_exe_is_utf8() -> bool {
    std::env::current_exe()
        .ok()
        .and_then(|p| p.into_os_string().into_string().ok())
        .is_some()
}
// Run at install/startup: refuse to install or invoke workflow lanes from non-UTF-8 paths.

Prevention

When it happens

Trigger: The codewhale binary lives at a path whose bytes are not valid UTF-8 (legacy-encoding filenames on Linux, unusual install dirs) and any workflow command is invoked, forcing the self re-exec path.

Common situations: Containers or scripts copying the binary into byte-encoded paths; filesystems with non-UTF-8 locale names; extremely rare on standard installs.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16). Data as JSON: /api/errors/8db9036d188702be. Report an issue: GitHub.