{"record":{"id":"e17131594f36be97","repo":"block/buzz","slug":"pi-skill-paths-must-be-valid-utf-8","errorCode":null,"errorMessage":"Pi skill paths must be valid UTF-8","messagePattern":"Pi skill paths must be valid UTF-8","errorType":"exception","errorClass":"io::Error (InvalidData)","httpStatus":null,"severity":"error","filePath":"crates/buzz-acp/src/pi_launcher.rs","lineNumber":208,"sourceCode":"fn launcher_script(\n    pi_command: &str,\n    prompt_path: Option<&Path>,\n    managed_skills_dir: &Path,\n) -> io::Result<String> {\n    let system_prompt_arg = match prompt_path {\n        Some(prompt_path) => {\n            let prompt_path = prompt_path.to_str().ok_or_else(|| {\n                io::Error::new(\n                    io::ErrorKind::InvalidData,\n                    \"Pi launcher paths must be valid UTF-8\",\n                )\n            })?;\n            format!(\" --system-prompt \\\"{}\\\"\", batch_escape(prompt_path))\n        }\n        None => String::new(),\n    };\n    let managed_skills_dir = managed_skills_dir.to_str().ok_or_else(|| {\n        io::Error::new(\n            io::ErrorKind::InvalidData,\n            \"Pi skill paths must be valid UTF-8\",\n        )\n    })?;\n    Ok(format!(\n        \"@echo off\\r\\n\\\"{}\\\"{} --skill \\\"{}\\\" %*\\r\\nexit /b %ERRORLEVEL%\\r\\n\",\n        batch_escape(pi_command),\n        system_prompt_arg,\n        batch_escape(managed_skills_dir),\n    ))\n}\n\n#[cfg(windows)]\nfn batch_escape(value: &str) -> String {\n    value.replace('%', \"%%\").replace('\"', \"\\\"\\\"\")\n}\n\n#[cfg(not(any(unix, windows)))]","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/block/buzz/blob/dad5a33865fc81a2e55b3b60746632f615ec1e3a/crates/buzz-acp/src/pi_launcher.rs#L190-L226","documentation":"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.","triggerScenarios":"Thrown at crates/buzz-acp/src/pi_launcher.rs:208 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a UTF-8-safe path for the system prompt file (rename or relocate it)","Regenerate the prompt path through Buzz's managed temp/skills directories, which use UTF-8 names","Avoid user-supplied non-ASCII byte paths when configuring Pi system prompts"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"dad5a33865fc81a2e55b3b60746632f615ec1e3a","analyzedAt":"2026-09-05T18:13:50.666Z","contentChangedAt":"2026-09-05T18:13:50.666Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}