{"record":{"id":"21b4614815b88e9e","repo":"BoundaryML/baml","slug":"failed-to-parse-json-response-e","errorCode":null,"errorMessage":"Failed to parse JSON response: {e}","messagePattern":"Failed to parse JSON response: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/playground-server/src/server.rs","lineNumber":156,"sourceCode":"    // Check if the response is successful\n    if !resp.status().is_success() {\n        let status = resp.status();\n        let body = resp\n            .text()\n            .await\n            .unwrap_or_else(|_| \"Failed to read response body\".to_string());\n        return Err(anyhow::anyhow!(\n            \"GitHub API request failed with status {}: {}\",\n            status,\n            body\n        ));\n    }\n\n    tracing::info!(\"Parsing JSON response...\");\n    let release: serde_json::Value = resp\n        .json()\n        .await\n        .map_err(|e| anyhow::anyhow!(\"Failed to parse JSON response: {e}\"))?;\n\n    // Find the main asset\n    let assets = release[\"assets\"]\n        .as_array()\n        .ok_or_else(|| anyhow::anyhow!(\"No assets in release metadata\"))?;\n    let asset = assets\n        .iter()\n        .find(|a| a[\"name\"].as_str() == Some(&web_panel_asset_name))\n        .ok_or_else(|| anyhow::anyhow!(\"No asset named '{}' in release\", web_panel_asset_name))?;\n    let download_url = asset[\"browser_download_url\"]\n        .as_str()\n        .ok_or_else(|| anyhow::anyhow!(\"No download URL for asset\"))?;\n\n    // Find the checksum asset\n    let checksum_asset = assets\n        .iter()\n        .find(|a| a[\"name\"].as_str() == Some(&checksum_asset_name))\n        .ok_or_else(|| {","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/playground-server/src/server.rs#L138-L174","documentation":"Once a successful response is received, get_playground_dist deserializes the body into serde_json::Value via resp.json(). If the body is not valid JSON (or the content is malformed/HTML), the reqwest/serde error is wrapped with this message. GitHub is expected to return JSON, so this indicates the body was not the expected release payload.","triggerScenarios":"resp.json::<serde_json::Value>() fails because the response body is not parseable JSON — e.g. a proxy or captive portal returned an HTML error page with a 2xx status, or the body was truncated.","commonSituations":"Corporate proxy/interception appliance returning HTML with 200 OK; a caching layer serving a corrupt or empty body; misrouted request hitting a non-GitHub endpoint after config changes.","solutions":["Log or capture the raw response body to see what was actually returned (likely HTML from a proxy).","Bypass or correctly configure the corporate proxy so api.github.com returns real JSON (Content-Type: application/json).","Retry the request if the body was truncated by a transient network issue.","Verify the API URL hasn't been redirected to an unexpected host."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// treat non-JSON bodies (proxy pages) as network-layer failure\nmatch get_playground_dist().await {\n    Err(e) if e.to_string().contains(\"Failed to parse JSON response\") => {\n        eprintln!(\"Non-JSON body — check proxy/interception\");\n        fallback_to_bundled_dist();\n    }\n    other => other?,\n}","preventionTips":["Bypass TLS-intercepting proxies for api.github.com","Verify Content-Type: application/json in your network","Keep a bundled dist as fallback","Log raw bodies when parsing fails"],"tags":["json","github-api","parsing","rust"],"backgroundTag":"json-parse-error","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}