block/buzz · error · io::Error (InvalidData)

Pi launcher paths must be valid UTF-8

Error message

Pi launcher paths must be valid UTF-8

What it means

Raised in shell_quote (unix) when the given OsStr — a Pi launcher command, system-prompt path, or managed skills dir path — cannot be converted to valid UTF-8 (to_str returns None). The generated POSIX shell script is plain text, so non-UTF-8 paths (e.g. raw bytes from a non-UTF-8 locale filesystem) cannot be safely embedded; the guard converts that into an InvalidData io::Error instead of emitting a corrupt script.

Source

Thrown at crates/buzz-acp/src/pi_launcher.rs:181

    prompt_path: Option<&Path>,
    managed_skills_dir: &Path,
) -> io::Result<String> {
    let system_prompt_arg = match prompt_path {
        Some(prompt_path) => format!(" --system-prompt {}", shell_quote(prompt_path.as_os_str())?),
        None => String::new(),
    };
    Ok(format!(
        "#!/bin/sh\nexec {}{} --skill {} \"$@\"\n",
        shell_quote(OsStr::new(pi_command))?,
        system_prompt_arg,
        shell_quote(managed_skills_dir.as_os_str())?,
    ))
}

#[cfg(unix)]
fn shell_quote(value: &OsStr) -> io::Result<String> {
    let value = value.to_str().ok_or_else(|| {
        io::Error::new(
            io::ErrorKind::InvalidData,
            "Pi launcher paths must be valid UTF-8",
        )
    })?;
    Ok(format!("'{}'", value.replace('\'', "'\"'\"'")))
}

#[cfg(windows)]
fn launcher_script(
    pi_command: &str,
    prompt_path: Option<&Path>,
    managed_skills_dir: &Path,
) -> io::Result<String> {
    let system_prompt_arg = match prompt_path {
        Some(prompt_path) => {
            let prompt_path = prompt_path.to_str().ok_or_else(|| {
                io::Error::new(
                    io::ErrorKind::InvalidData,

View on GitHub (pinned to dad5a33865)

Solutions

  1. Rename or move the Pi command / prompt / skills directory to a path containing only valid UTF-8 characters
  2. Fix the locale/filesystem encoding so paths are reported as UTF-8
  3. Pass ASCII-safe paths via Buzz's agent configuration rather than raw OS strings
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/buzz-acp/src/pi_launcher.rs:181 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of block/buzz@dad5a33865 (2026-09-05). Data as JSON: /api/errors/ace650b8777fd6d5. Report an issue: GitHub.