BoundaryML/baml · error

GitHub API request failed with status

Error message

GitHub API request failed with status {}: {}

What it means

After sending the release-metadata request, get_playground_dist checks resp.status().is_success(). If GitHub answered with a non-2xx status (404 for a missing release, 403 rate limit, 5xx server error), it reads the response body and returns this error including the status and body text. The server side of the request succeeded but GitHub rejected or failed it.

Solutions

  1. Check the status in the message: 403 with 'rate limit' in the body means wait or set a GITHUB_TOKEN to raise the limit.
  2. Verify the release/tag being queried still exists on the GitHub repo and that the repo/API URL is correct.
  3. Retry later if the status is 5xx (GitHub-side incident).
  4. Pin the server to a known-good release version instead of always fetching the latest release.
Defensive patterns

Strategy: try-catch

Try / catch

// inspect the embedded status/body to branch on cause
match get_playground_dist().await {
    Err(e) if e.to_string().contains("status 403") => {
        eprintln!("GitHub rate limited or forbidden; set GITHUB_TOKEN or wait");
    }
    Err(e) if e.to_string().contains("status 404") => {
        eprintln!("Release not found; pin a valid version");
    }
    Err(e) => return Err(e),
    Ok(d) => Ok(d),
}

Prevention

When it happens

Trigger: The GET to the GitHub releases API returns a non-success HTTP status — most commonly 403 rate-limit (unauthenticated GitHub API: 60 req/hour per IP), 404 for a nonexistent release/tag, or 5xx from GitHub.

Common situations: Shared CI IPs hitting GitHub's unauthenticated rate limit; the configured release tag/asset no longer exists after a repo reorganization or version change; GitHub incidents.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/3e8a202e24215b17. Report an issue: GitHub.

Appendix: source

Thrown at engine/playground-server/src/server.rs:145

    tracing::info!("Sending request to GitHub API...");
    let resp = client
        .get(&api_url)
        .header("User-Agent", "baml-playground-server")
        .send()
        .await
        .map_err(|e| anyhow::anyhow!("Failed to fetch release metadata: {e}"))?;

    tracing::info!("Received response with status: {}", resp.status());

    // Check if the response is successful
    if !resp.status().is_success() {
        let status = resp.status();
        let body = resp
            .text()
            .await
            .unwrap_or_else(|_| "Failed to read response body".to_string());
        return Err(anyhow::anyhow!(
            "GitHub API request failed with status {}: {}",
            status,
            body
        ));
    }

    tracing::info!("Parsing JSON response...");
    let release: serde_json::Value = resp
        .json()
        .await
        .map_err(|e| anyhow::anyhow!("Failed to parse JSON response: {e}"))?;

    // Find the main asset
    let assets = release["assets"]
        .as_array()
        .ok_or_else(|| anyhow::anyhow!("No assets in release metadata"))?;
    let asset = assets
        .iter()

View on GitHub (pinned to bd85ce9dee)