{"record":{"id":"7359e7e0f582d2eb","repo":"BoundaryML/baml","slug":"no-upload-url-provided-when-should-upload-is-true","errorCode":null,"errorMessage":"No upload URL provided when should_upload is true","messagePattern":"No upload URL provided when should_upload is true","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-runtime/src/tracingv2/publisher/publisher.rs","lineNumber":643,"sourceCode":"        {\n            Ok(response) => response,\n            Err(e) => {\n                tracing::warn!(\"Failed to check BAML source upload status: {}\", e);\n                return Err(e.into());\n            }\n        };\n        tracing::debug!(\"check_response={:?}\", check_response);\n\n        if !check_response.should_upload {\n            tracing::debug!(\"BAML source already uploaded, skipping\");\n            return Ok(());\n        }\n\n        tracing::debug!(\"Uploading BAML source\");\n\n        let upload_url = check_response\n            .upload_url\n            .ok_or_else(|| anyhow::anyhow!(\"No upload URL provided when should_upload is true\"))?;\n\n        let upload_metadata = check_response.upload_metadata.ok_or_else(|| {\n            anyhow::anyhow!(\"No upload metadata provided when should_upload is true\")\n        })?;\n\n        // Create the upload payload\n        let payload = BamlSrcUploadS3File { ast: ast_obj };\n\n        // Upload to S3\n        lookup\n            .client\n            .put(upload_url)\n            .json(&payload)\n            .headers({\n                let mut headers = reqwest::header::HeaderMap::new();\n                for (key, value) in upload_metadata.to_map() {\n                    let header_name = format!(\"x-amz-meta-{key}\");\n                    if let (Ok(name), Ok(val)) = (","sourceCodeStart":625,"sourceCodeEnd":661,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/tracingv2/publisher/publisher.rs#L625-L661","documentation":"Raised in process_baml_src_upload_impl (called by process_baml_src_upload) when the server's check response indicates should_upload is true but omits the upload_url field. The publisher uploads the BAML source AST to S3 during trace publishing, and it cannot proceed without a pre-signed upload URL. This indicates the BAML API responded successfully but returned an inconsistent/incomplete payload.","triggerScenarios":"The collector's upload-check response has should_upload=true but upload_url=None — server bug, schema drift between client and server, or a proxy stripping/mangling JSON fields in the response.","commonSituations":"Version mismatch between the BAML runtime client and the BAML cloud API, self-hosted gateway returning an older response shape, or an intermediary proxy altering the JSON body.","solutions":["Update the BAML runtime and BAML cloud/gateway to compatible versions.","Check whether a proxy/gateway is modifying the API response.","Capture and report the raw check response body to BAML support.","Retry the publish; if persistent, disable baml_src upload via trace config."],"exampleFix":"// before\nlet upload_url = check_response.upload_url.unwrap();\n// after\nlet upload_url = check_response.upload_url.ok_or_else(|| {\n    anyhow::anyhow!(\"No upload URL provided when should_upload is true\")\n})?;","handlingStrategy":"try-catch","validationCode":"# sanity-check the check response before upload\nresp = requests.post(f\"{BAML_URL}/v1/baml-src/check\", headers=auth, json=req)\ndata = resp.json()\nif data.get(\"should_upload\") and not data.get(\"upload_url\"):\n    raise RuntimeError(\"server said should_upload but returned no upload_url\")","typeGuard":"def has_upload_target(resp) -> bool:\n    return not resp.should_upload or (resp.upload_url is not None and resp.upload_metadata is not None)","tryCatchPattern":"match process_baml_src_upload().await {\n    Err(e) if e.to_string().contains(\"No upload URL\") => {\n        log::warn!(\"collector returned inconsistent check response; skipping src upload\");\n    }\n    Err(e) => return Err(e),\n    Ok(_) => {}\n}","preventionTips":["Pin matching versions of baml-runtime and the BAML API","Log the raw check response body on failure","Report inconsistent responses to BAML support","Keep proxy/WAF rules from altering API JSON"],"tags":["baml","tracing","upload","unexpected-response"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}