{"record":{"id":"f6e37f87d6e074b3","repo":"block/buzz","slug":"pi-acp-pi-command-is-managed-by-buzz-unset-it-bef","errorCode":null,"errorMessage":"PI_ACP_PI_COMMAND is managed by Buzz; unset it before starting a managed Pi agent","messagePattern":"PI_ACP_PI_COMMAND is managed by Buzz; unset it before starting a managed Pi agent","errorType":"exception","errorClass":"io::Error (AlreadyExists)","httpStatus":null,"severity":"error","filePath":"crates/buzz-acp/src/pi_launcher.rs","lineNumber":47,"sourceCode":"\nimpl PiLaunchOverride {\n    /// Prepare a Pi launcher when the configured ACP adapter is `pi-acp`.\n    ///\n    /// Returns the prompt that still needs ordinary ACP delivery. For Pi, the\n    /// base prompt moves into Pi's native system role and is therefore removed\n    /// from first-turn user framing. Other adapters receive it unchanged.\n    pub(crate) fn prepare(\n        agent_command: &str,\n        base_prompt: Option<String>,\n        managed_skills_dir: &Path,\n        inherited_pi_command_is_set: bool,\n    ) -> io::Result<(Option<Self>, Option<String>)> {\n        if crate::config::normalize_agent_command_identity(agent_command) != \"pi-acp\" {\n            return Ok((None, base_prompt));\n        }\n\n        if inherited_pi_command_is_set {\n            return Err(io::Error::new(\n                io::ErrorKind::AlreadyExists,\n                \"PI_ACP_PI_COMMAND is managed by Buzz; unset it before starting a managed Pi agent\",\n            ));\n        }\n\n        // Buzz owns PI_ACP_PI_COMMAND and always uses it to point pi-acp at\n        // this generated launcher. The launcher resolves the ordinary `pi`\n        // command from Buzz's effective PATH.\n        let prepared = Self::create(\"pi\", base_prompt.as_deref(), managed_skills_dir)?;\n        Ok((Some(prepared), None))\n    }\n\n    pub(crate) fn launcher_path(&self) -> &Path {\n        &self.launcher\n    }\n\n    fn create(\n        pi_command: &str,","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/block/buzz/blob/dad5a33865fc81a2e55b3b60746632f615ec1e3a/crates/buzz-acp/src/pi_launcher.rs#L29-L65","documentation":"Raised in PiLaunchOverride::prepare when inherited_pi_command_is_set is true, i.e. the environment variable PI_ACP_PI_COMMAND is present while Buzz is launching a managed Pi agent. That variable is reserved for Buzz's own management of the Pi subprocess; a user- or parent-supplied value would conflict with the launcher override Buzz generates, so prepare refuses with this InvalidData io::Error. Generic validation guard; the input at fault is the inherited PI_ACP_PI_COMMAND environment variable.","triggerScenarios":"Thrown at crates/buzz-acp/src/pi_launcher.rs:47 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Unset PI_ACP_PI_COMMAND in the environment before starting the managed Pi agent","Remove any shell profile, wrapper script, or harness export that sets PI_ACP_PI_COMMAND for agent subprocesses","If a custom Pi command is genuinely needed, use Buzz's supported configuration option for the agent command instead of the managed env var"],"exampleFix":null,"handlingStrategy":"validation","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"}