BigPizzaV3/CodexPlusPlus · error
中转 Base URL 不能为空
Error message
中转 Base URL 不能为空
What it means
Thrown by apply_relay_config_to_home_with_protocol in crates/codex-plus-core/src/relay_config.rs when the base_url argument is empty after trimming. This is the entry point that writes the codex live config (upsert_model_provider_config) and auth.json into the given home directory; a blank base URL means there is no upstream to point codex at, so it fails before touching any files.
Source
Thrown at crates/codex-plus-core/src/relay_config.rs:276
apply_relay_config_to_home_with_protocol(
home,
base_url,
bearer_token,
RelayProtocol::Responses,
crate::protocol_proxy::DEFAULT_PROTOCOL_PROXY_PORT,
)
}
pub fn apply_relay_config_to_home_with_protocol(
home: &Path,
base_url: &str,
bearer_token: &str,
protocol: RelayProtocol,
proxy_port: u16,
) -> anyhow::Result<RelayApplyResult> {
let base_url = base_url.trim();
if base_url.is_empty() {
anyhow::bail!("中转 Base URL 不能为空");
}
let bearer_token = bearer_token.trim();
if bearer_token.is_empty() {
anyhow::bail!("中转 Key 不能为空");
}
let codex_base_url = codex_base_url_for_protocol(base_url, protocol, proxy_port);
let updated = upsert_model_provider_config("", &codex_base_url, bearer_token, true)?;
let auth_contents = serde_json::to_string_pretty(&json!({
"OPENAI_API_KEY": bearer_token
}))?;
let backup_path =
write_codex_live_atomic(home, Some(&updated), Some(auth_contents.as_bytes()), false)?;
let status = relay_config_status_from_home(home);
Ok(RelayApplyResult {
config_path: status.config_path,
backup_path,
configured: status.configured,
})View on GitHub (pinned to 1f431ae49b)
Solutions
- Pass a non-empty base URL such as https://relay.example.com when applying the relay config
- Trace where the argument came from — usually a profile field or env var that was never populated — and populate it
- Guard the call site: skip or prompt when the profile's base_url trims to empty
Example fix
// before
apply_relay_config_to_home(&home, &profile.base_url, &profile.api_key)?;
// after
let base_url = profile.base_url.trim();
if base_url.is_empty() {
anyhow::bail!("profile {} has no base URL configured", profile.name);
}
apply_relay_config_to_home(&home, base_url, &profile.api_key)?; Defensive patterns
Strategy: validation
Validate before calling
let base_url = base_url.trim();
let token = bearer_token.trim();
if base_url.is_empty() || token.is_empty() {
anyhow::bail!("base URL and key are required before applying relay config");
} Prevention
- Disable the apply/activate action until the profile has both base_url and key filled
- In automation scripts, assert both values are non-empty before calling apply functions
- Fail fast at the UI layer rather than letting the config writer reject the call
When it happens
Trigger: Calling apply_relay_config_to_home / apply_relay_config_to_home_with_protocol with an empty or whitespace base_url; UI apply button hit before the base URL field was filled; caller passing an unset environment variable or profile field straight through.
Common situations: Relay activation flow invoked with a half-filled profile; scripts automating config generation that read an empty variable; profile switch racing a settings edit that cleared the URL.
Related errors
- Base URL 为空
- Base URL 不能为空
- CDP WebSocket URL must include an explicit port
- Responses 请求体不是 UTF-8:{error}
- downloaded openai/plugins marketplace is invalid
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@1f431ae49b (2026-08-16).
Data as JSON: /api/errors/1da5718ff11cb388.
Report an issue: GitHub.