{"record":{"id":"acaf78800e02e6ba","repo":"openai/codex","slug":"label-must-be-valid-unicode-for-remote-mcp-stdio","errorCode":null,"errorMessage":"{label} must be valid Unicode for remote MCP stdio","messagePattern":"(.+?) must be valid Unicode for remote MCP stdio","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/rmcp-client/src/stdio_server_launcher.rs","lineNumber":662,"sourceCode":"        }\n        Ok(argv)\n    }\n\n    fn process_api_env(env: HashMap<OsString, OsString>) -> Result<HashMap<String, String>> {\n        env.into_iter()\n            .map(|(key, value)| {\n                Ok((\n                    Self::os_string_to_process_api_string(key, \"environment variable name\")?,\n                    Self::os_string_to_process_api_string(value, \"environment variable value\")?,\n                ))\n            })\n            .collect()\n    }\n\n    fn os_string_to_process_api_string(value: OsString, label: &str) -> Result<String> {\n        value\n            .into_string()\n            .map_err(|_| anyhow!(\"{label} must be valid Unicode for remote MCP stdio\"))\n    }\n\n    fn remote_env_policy(remote_env_vars: &[String]) -> ExecEnvPolicy {\n        let include_only = if remote_env_vars.is_empty() {\n            Vec::new()\n        } else {\n            // `source = \"remote\"` means the value is read from the executor's\n            // environment, not copied from Codex. Start from `All` only so the\n            // named remote variable is available to the filter below; the\n            // effective child env is still limited by `include_only`.\n            crate::utils::DEFAULT_ENV_VARS\n                .iter()\n                .map(|name| (*name).to_string())\n                .chain(remote_env_vars.iter().cloned())\n                .collect()\n        };\n        ExecEnvPolicy {\n            inherit: if remote_env_vars.is_empty() {","sourceCodeStart":644,"sourceCodeEnd":680,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/rmcp-client/src/stdio_server_launcher.rs#L644-L680","documentation":"Validation guard in ExecEnvPolicy's os_string_to_process_api_string: an environment variable name or value in the MCP server's configured env is not valid Unicode, so it cannot be passed through the process API used for remote stdio. The offending OsString is labeled in the message.","triggerScenarios":"Thrown at codex-rs/rmcp-client/src/stdio_server_launcher.rs:662 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the env_vars entry so its name and value are valid UTF-8","Remove the non-Unicode variable from the MCP server configuration"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}