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

Pi skill paths must be valid UTF-8

Error message

Pi skill paths must be valid UTF-8

What it means

Raised in launcher_script when prompt_path.to_str() fails, i.e. the system-prompt file path supplied for a managed Pi agent is not valid UTF-8. The Windows-style batch launcher embeds the prompt path in a text script, so a non-UTF-8 path cannot be represented; this guard rejects it with InvalidData rather than writing a mangled path. The input at fault is the prompt_path argument.

Source

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

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,
                    "Pi launcher paths must be valid UTF-8",
                )
            })?;
            format!(" --system-prompt \"{}\"", batch_escape(prompt_path))
        }
        None => String::new(),
    };
    let managed_skills_dir = managed_skills_dir.to_str().ok_or_else(|| {
        io::Error::new(
            io::ErrorKind::InvalidData,
            "Pi skill paths must be valid UTF-8",
        )
    })?;
    Ok(format!(
        "@echo off\r\n\"{}\"{} --skill \"{}\" %*\r\nexit /b %ERRORLEVEL%\r\n",
        batch_escape(pi_command),
        system_prompt_arg,
        batch_escape(managed_skills_dir),
    ))
}

#[cfg(windows)]
fn batch_escape(value: &str) -> String {
    value.replace('%', "%%").replace('"', "\"\"")
}

#[cfg(not(any(unix, windows)))]

View on GitHub (pinned to dad5a33865)

Solutions

  1. Use a UTF-8-safe path for the system prompt file (rename or relocate it)
  2. Regenerate the prompt path through Buzz's managed temp/skills directories, which use UTF-8 names
  3. Avoid user-supplied non-ASCII byte paths when configuring Pi system prompts
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/buzz-acp/src/pi_launcher.rs:208 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/e17131594f36be97. Report an issue: GitHub.