{"record":{"id":"63e0a526d930eb97","repo":"BoundaryML/baml","slug":"unexpected-status-d-fetching-checksum-s","errorCode":null,"errorMessage":"unexpected status %d fetching checksum %s","messagePattern":"unexpected status (.+?) fetching checksum (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/language_client_go/baml_go/lib_common.go","lineNumber":589,"sourceCode":"\n//orchestrion:ignore\nfunc downloadChecksum(checksumURL string, targetFilename string) (string, error) {\n\t// Use uninstrumented client to avoid Orchestrion crash during init()\n\t//orchestrion:ignore\n\thttpClient := uninstrumentedHTTPClient()\n\t//orchestrion:ignore\n\tresp, err := httpClient.Get(checksumURL)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"network error fetching checksum %s: %w\", checksumURL, err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode == http.StatusNotFound {\n\t\tlogger.Debug(\"Checksum file not found (404)\", \"url\", checksumURL)\n\t\treturn \"\", fmt.Errorf(\"checksum file not found (404)\")\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"unexpected status %d fetching checksum %s\", resp.StatusCode, checksumURL)\n\t}\n\n\tbodyBytes, err := io.ReadAll(io.LimitReader(resp.Body, 4096))\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error reading checksum body %s: %w\", checksumURL, err)\n\t}\n\n\tlines := strings.Split(string(bodyBytes), \"\\n\")\n\tfor _, line := range lines {\n\t\tparts := strings.Fields(line)\n\t\tif len(parts) >= 2 {\n\t\t\tchecksum, filenameInLine := parts[0], strings.TrimPrefix(parts[1], \"*\")\n\t\t\tif filenameInLine == targetFilename {\n\t\t\t\tif len(checksum) == 64 && isHex(checksum) {\n\t\t\t\t\tlogger.Debug(\"Found matching checksum in file\", \"filename\", targetFilename, \"checksum\", checksum)\n\t\t\t\t\treturn checksum, nil\n\t\t\t\t}\n\t\t\t\tlogger.Warn(\"Invalid checksum format found in checksum file\",","sourceCodeStart":571,"sourceCodeEnd":607,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_client_go/baml_go/lib_common.go#L571-L607","documentation":"The checksum endpoint returned a status code that is neither 200 nor 404 (e.g. 500, 502, 403). downloadChecksum surfaces the status and URL in a plain error to indicate an unexpected server-side response.","triggerScenarios":"httpClient.Get(checksumURL) returns a response with an unexpected status such as 403 Forbidden (blocked by CDN/WAF), 500, or 503 from the artifact server.","commonSituations":"CDN or WAF blocking the request from CI environments, upstream server outage returning 5xx, or rate limiting by the distribution host.","solutions":["Check the artifact server status; retry after transient 5xx","Inspect whether a WAF/CDN blocks your user agent or IP (403) and adjust headers/proxy","Add retry with backoff around checksum/download in CI","Verify the checksum URL endpoint is still valid after infrastructure changes"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"var cs string\nvar err error\nfor i := 0; i < 3; i++ {\n    cs, err = downloadChecksum(url, name)\n    if err == nil || !strings.Contains(err.Error(), \"unexpected status\") { break }\n    time.Sleep(time.Duration(1<<i) * time.Second)\n}","preventionTips":["Add retries with backoff for 5xx responses","Whitelist artifact hosts in corporate WAFs/CDNs for CI IPs","Alert on recurring non-200/404 statuses from the distribution endpoint","Use a mirror when the primary artifact server is unstable"],"tags":["http","status-code","checksum","server-error"],"backgroundTag":"http-error-response","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}