BigPizzaV3/CodexPlusPlus · error
Base URL 为空
Error message
Base URL 为空
What it means
Thrown by normalize_request in crates/codex-plus-core/src/provider_import.rs when the import request's base_url is empty after trimming and stripping trailing slashes. Note the normalization removes trailing '/' characters first, so a value consisting solely of slashes ("/") also becomes empty and triggers this error. The base URL is required to build the provider's config.toml via build_config_toml.
Source
Thrown at crates/codex-plus-core/src/provider_import.rs:226
vlm_base_url: String::new(),
user_agent: String::new(),
sub2api_enabled: false,
sub2api_multiplier: String::new(),
model_routes: Vec::new(),
}
}
fn normalize_request(mut request: ProviderImportRequest) -> anyhow::Result<ProviderImportRequest> {
request.name = request.name.trim().to_string();
request.base_url = request.base_url.trim().trim_end_matches('/').to_string();
request.api_key = request.api_key.trim().to_string();
request.wire_api = request.wire_api.trim().to_ascii_lowercase();
request.relay_mode = request.relay_mode.trim().to_ascii_lowercase();
if request.name.is_empty() {
anyhow::bail!("供应商名称为空");
}
if request.base_url.is_empty() {
anyhow::bail!("Base URL 为空");
}
if request.api_key.is_empty() {
anyhow::bail!("API Key 为空");
}
request.config_contents = build_config_toml(
&request.base_url,
&request.api_key,
relay_protocol(&request.wire_api),
);
request.auth_contents = build_auth_json(&request.api_key);
Ok(request)
}
fn relay_protocol(value: &str) -> RelayProtocol {
match value.trim().to_ascii_lowercase().as_str() {
"chat" | "chat_completions" | "chat-completions" => RelayProtocol::ChatCompletions,
_ => RelayProtocol::Responses,
}View on GitHub (pinned to 1f431ae49b)
Solutions
- Supply the full upstream origin, e.g. https://api.vendor.com (scheme + host; path optional)
- Check the share link includes the baseUrl parameter and it is URL-encoded correctly
- Make sure the value is not just slashes or whitespace
Example fix
# before
{"name": "VendorAI", "baseUrl": "", "apiKey": "sk-..."}
# after
{"name": "VendorAI", "baseUrl": "https://api.vendor.com", "apiKey": "sk-..."} Defensive patterns
Strategy: validation
Validate before calling
fn base_url_valid(url: &str) -> bool {
let t = url.trim().trim_end_matches('/');
!t.is_empty() && (t.starts_with(\"http://\") || t.starts_with(\"https://\"))
} Prevention
- Require a scheme-qualified origin (https://host) in the import form
- Include baseUrl in every generated share link
- Validate with a URL parser before submitting the import
When it happens
Trigger: Import request with baseUrl omitted, blank, or "/"; share link missing the baseUrl query parameter; pasting only a path fragment (e.g. "/v1") instead of a full origin.
Common situations: Share links generated without baseUrl; users pasting just the path portion of an endpoint; forms where the URL input was optional but the backend requires it.
Related errors
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@1f431ae49b (2026-08-16).
Data as JSON: /api/errors/64ecae3d5fe232e2.
Report an issue: GitHub.