{"record":{"id":"8d9709958c3b8822","repo":"BigPizzaV3/CodexPlusPlus","slug":"llm-bridge","errorCode":null,"errorMessage":"LLM Bridge 请求体过大","messagePattern":"LLM Bridge 请求体过大","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/routes.rs","lineNumber":733,"sourceCode":"        .map(str::trim)\n        .filter(|value| !value.is_empty())\n        .unwrap_or(\"POST\");\n    if !method.eq_ignore_ascii_case(\"POST\") {\n        anyhow::bail!(\"LLM Bridge 仅支持 POST 请求\");\n    }\n\n    let timeout_ms = payload\n        .get(\"timeout_ms\")\n        .and_then(Value::as_u64)\n        .unwrap_or(60_000)\n        .clamp(1_000, 60_000);\n    let body = payload\n        .get(\"body\")\n        .and_then(Value::as_str)\n        .unwrap_or_default()\n        .to_string();\n    if body.len() > 1_048_576 {\n        anyhow::bail!(\"LLM Bridge 请求体过大\");\n    }\n\n    let client = reqwest::Client::builder()\n        .timeout(std::time::Duration::from_millis(timeout_ms))\n        .redirect(reqwest::redirect::Policy::none())\n        .build()?;\n    let response = client\n        .post(url)\n        .headers(llm_proxy_headers(&payload)?)\n        .body(body)\n        .send()\n        .await?;\n    let http_status = response.status().as_u16();\n    let ok = response.status().is_success();\n    let content_type = response\n        .headers()\n        .get(reqwest::header::CONTENT_TYPE)\n        .and_then(|value| value.to_str().ok())","sourceCodeStart":715,"sourceCodeEnd":751,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/routes.rs#L715-L751","documentation":"llm_proxy_value caps the forwarded request body at 1 MiB (1_048_576 bytes) and bails when body.len() exceeds it. The LLM Bridge proxies a caller-supplied body to a remote endpoint; oversized bodies would balloon memory and upstream latency, so they are rejected before the reqwest call.","triggerScenarios":"Sending a bridge payload whose \"body\" string exceeds 1,048,576 bytes.","commonSituations":"Attaching very long conversation history or large documents in a single request; embedding base64 files in the body; a client batching many messages without truncation.","solutions":["Trim/summarize the request body below 1 MiB before sending","Offload large content to a URL/file reference the downstream API can fetch","Split the request into multiple smaller bridge calls"],"exampleFix":"// before\nbody = build_body(all_messages); // 2 MB\nsend_bridge(body);\n// after\nbody = build_body(truncate_messages(all_messages, MAX_BODY = 1_048_576));\nsend_bridge(body);","handlingStrategy":"validation","validationCode":"fn body_within_limit(body: &str) -> bool { body.len() <= 1_048_576 }","typeGuard":null,"tryCatchPattern":"match llm_proxy_value(payload).await {\n    Err(e) if e.to_string().contains(\"请求体过大\") => {\n        payload[\"body\"] = serde_json::json!(truncate(payload[\"body\"].as_str().unwrap_or_default()));\n        retry(payload)\n    }\n    other => other,\n}","preventionTips":["Check body.len() before building the bridge payload","Truncate or summarize long conversation history","Stream large attachments via URLs instead of inlining them"],"tags":["http","request-size","llm-bridge"],"backgroundTag":"payload-too-large","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"}