openai/codex · error · anyhow::Error
env_vars entry ` ` uses source `remote`, which requires…
Error message
env_vars entry `{}` uses source `remote`, which requires remote MCP stdio What it means
Validation guard in local_stdio_env_var_names: an env_vars entry declares source "remote", but the server being launched is a local stdio server, for which remote-sourced environment variables cannot be provided. The misconfigured McpServerEnvVar entry is the input at fault.
Solutions
- Change the env_vars entry's source to a local-compatible source, or remove it
- Move the remote-sourced variable to a server configuration that actually uses remote MCP stdio
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/rmcp-client/src/utils.rs:92 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/b861c4efc5c20044.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/rmcp-client/src/utils.rs:92
env.retain(|name, _| {
name.to_str()
.is_none_or(|name| !is_non_inheritable_env_var(name))
});
env
}
pub(crate) fn remote_mcp_env_var_names(env_vars: &[McpServerEnvVar]) -> Vec<String> {
env_vars
.iter()
.filter(|var| var.is_remote_source())
.filter(|var| !is_non_inheritable_env_var(var.name()))
.map(|var| var.name().to_string())
.collect()
}
fn local_stdio_env_var_names(env_vars: &[McpServerEnvVar]) -> Result<impl Iterator<Item = &str>> {
if let Some(remote_var) = env_vars.iter().find(|var| var.is_remote_source()) {
return Err(anyhow!(
"env_vars entry `{}` uses source `remote`, which requires remote MCP stdio",
remote_var.name()
));
}
Ok(env_vars
.iter()
.map(McpServerEnvVar::name)
.filter(|name| !is_non_inheritable_env_var(name)))
}
pub(crate) fn build_default_headers(
http_headers: Option<HashMap<String, String>>,
env_http_headers: Option<HashMap<String, String>>,
) -> Result<HeaderMap> {
let mut headers = HeaderMap::new();
headers.insert(USER_AGENT, HeaderValue::from_static(MCP_USER_AGENT));
if let Some(static_headers) = http_headers {View on GitHub (pinned to 339751715c)