openai/codex · error
must not have leading or trailing whitespace
Error message
{LABEL} must not have leading or trailing whitespace What it means
The namespace in {LABEL} has leading or trailing whitespace (namespace.trim() != namespace). Invisible padding breaks exact-match tool resolution, so it is rejected rather than silently trimmed.
Solutions
- Trim leading and trailing whitespace from {LABEL}.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/core/src/config/mod.rs:3069 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/d0bf0b96eb1672fb.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/core/src/config/mod.rs:3069
"python",
"python_user_visible",
"submodel_delegator",
"terminal",
"tool_search",
"web",
];
let Some(namespace) = namespace else {
return Ok(());
};
if namespace.is_empty() {
return Err(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
format!("{LABEL} must not be empty"),
));
}
if namespace.trim() != namespace {
return Err(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
format!("{LABEL} must not have leading or trailing whitespace"),
));
}
if !namespace
.bytes()
.all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b'_' | b'-'))
{
return Err(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
format!("{LABEL} must match ^[a-zA-Z0-9_-]+$"),
));
}
if namespace.chars().count() > MAX_LEN {
return Err(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
format!("{LABEL} must be at most {MAX_LEN} characters"),
));View on GitHub (pinned to 339751715c)