{"record":{"id":"529a673743ead1e4","repo":"BigPizzaV3/CodexPlusPlus","slug":"error-529a67","errorCode":null,"errorMessage":"测试模型不能为空","messagePattern":"测试模型不能为空","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/relay_config.rs","lineNumber":682,"sourceCode":"    let base_url = relay_profile_base_url(profile);\n    let base_url = base_url.trim().trim_end_matches('/');\n    if base_url.is_empty() {\n        anyhow::bail!(\"Base URL 不能为空\");\n    }\n    let api_key = relay_profile_api_key(profile);\n    let api_key = api_key.trim();\n    if api_key.is_empty() && !profile.uses_no_auth() {\n        anyhow::bail!(\"API Key 不能为空\");\n    }\n\n    let client = crate::http_client::proxied_client(\"CodexPlusPlus/RelayTest\")?;\n    let endpoint = match profile.protocol {\n        RelayProtocol::Responses => format!(\"{base_url}/responses\"),\n        RelayProtocol::ChatCompletions => format!(\"{base_url}/chat/completions\"),\n    };\n    let test_model = model.trim();\n    if test_model.is_empty() {\n        anyhow::bail!(\"测试模型不能为空\");\n    }\n\n    let payload = relay_profile_test_payload(profile.protocol, test_model);\n    let mut request = client\n        .post(&endpoint)\n        .header(reqwest::header::CONTENT_TYPE, \"application/json\")\n        .json(&payload);\n    if !profile.uses_no_auth() {\n        request = request.bearer_auth(api_key);\n    }\n    let response = request.send().await?;\n    let http_status = response.status().as_u16();\n\n    // 如果 404 且 base_url 末尾没有 /v1，尝试自动补 /v1 后再发一次。\n    // 许多上游（中转站、自建代理）暴露的路径以 /v1/ 开头，\n    // 用户容易遗漏这个前缀，导致 /responses 或 /chat/completions 404。\n    if http_status == 404 && !base_url.ends_with(\"/v1\") {\n        let v1_url = format!(\"{base_url}/v1\");","sourceCodeStart":664,"sourceCodeEnd":700,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/relay_config.rs#L664-L700","documentation":"test_relay_profile sends a live request whose payload names a model; the test model parameter is trimmed and must be non-empty, otherwise the library bails before constructing relay_profile_test_payload. A request body without a model would be rejected by the relay anyway, so this is caught locally.","triggerScenarios":"Calling test_relay_profile(profile, model) with model == \"\" or whitespace only.","commonSituations":"The manager UI's 'test' button clicked before the user selected a model; a profile's default model field is blank because model_list was never populated.","solutions":["Pass a non-empty model name (e.g. \"gpt-4o\" or a model from the profile's model_list) to test_relay_profile","Pre-fill the test model from the profile's first configured model in the UI","Validate the model field in the UI before triggering the test"],"exampleFix":"// before\ntest_relay_profile(&profile, \"  \")?;\n// after\ntest_relay_profile(&profile, \"deepseek-v4-pro\")?;","handlingStrategy":"validation","validationCode":"if model.trim().is_empty() {\n    return Err(anyhow::anyhow!(\"测试模型不能为空\"));\n}","typeGuard":null,"tryCatchPattern":"match test_relay_profile(&profile, &model) {\n    Err(e) if e.to_string().contains(\"测试模型不能为空\") => preselect_first_model(&profile)?,\n    other => other?,\n}","preventionTips":["Default the test model to the first entry of the profile's model_list","Disable the test button until a model is chosen","Validate form fields before calling the test API"],"tags":["validation","empty-field","http-request"],"backgroundTag":"missing-required-argument","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}