{"record":{"id":"32474c11c59f62be","repo":"github/github-mcp-server","slug":"failed-to-process-log-content-w","errorCode":null,"errorMessage":"failed to process log content: %w","messagePattern":"failed to process log content: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/github/actions.go","lineNumber":186,"sourceCode":"func downloadLogContent(ctx context.Context, logURL string, tailLines int, maxLines int) (string, int, *http.Response, error) {\n\tprof := profiler.New(nil, profiler.IsProfilingEnabled())\n\tfinish := prof.Start(ctx, \"log_buffer_processing\")\n\n\thttpResp, err := http.Get(logURL) //nolint:gosec\n\tif err != nil {\n\t\treturn \"\", 0, httpResp, fmt.Errorf(\"failed to download logs: %w\", err)\n\t}\n\tdefer func() { _ = httpResp.Body.Close() }()\n\n\tif httpResp.StatusCode != http.StatusOK {\n\t\treturn \"\", 0, httpResp, fmt.Errorf(\"failed to download logs: HTTP %d\", httpResp.StatusCode)\n\t}\n\n\tbufferSize := min(tailLines, maxLines)\n\n\tprocessedInput, totalLines, httpResp, err := buffer.ProcessResponseAsRingBufferToEnd(httpResp, bufferSize)\n\tif err != nil {\n\t\treturn \"\", 0, httpResp, fmt.Errorf(\"failed to process log content: %w\", err)\n\t}\n\n\tlines := strings.Split(processedInput, \"\\n\")\n\tif len(lines) > tailLines {\n\t\tlines = lines[len(lines)-tailLines:]\n\t}\n\tfinalResult := strings.Join(lines, \"\\n\")\n\n\t_ = finish(len(lines), int64(len(finalResult)))\n\n\treturn finalResult, totalLines, httpResp, nil\n}\n\n// ActionsList returns the tool and handler for listing GitHub Actions resources.\nfunc ActionsList(t translations.TranslationHelperFunc) inventory.ServerTool {\n\ttool := NewTool(\n\t\tToolsetMetadataActions,\n\t\tmcp.Tool{","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/actions.go#L168-L204","documentation":"Returned by downloadLogContent (pkg/github/actions.go:186) when buffer.ProcessResponseAsRingBufferToEnd fails while streaming the downloaded log body into the fixed-size ring buffer. The only error that helper can produce is the wrapped body-read error from pkg/buffer/buffer.go:113, so this error is that read failure (connection reset mid-body, proxy timeout, TLS drop) with one extra layer of wrapping.","triggerScenarios":"Downloading large job logs with return_content=true when the response body read aborts mid-stream after the 200 status was already received: connection reset by peer, idle-timeout on proxies for slow transfers, or abrupt socket close by blob storage.","commonSituations":"Multi-hundred-MB debug logs streaming through corporate proxies; mobile/high-latency links dropping long transfers; server processes killed mid-read.","solutions":["Retry the tool call - a fresh signed URL and fresh connection usually completes","Shrink the exposure window by lowering tail_lines and content window size","If reproducible for one specific job, that log may be abnormally large - fetch it out-of-band (gh run download) instead","Unwrap to confirm the transport cause before assuming a server bug"],"exampleFix":"// before\nprocessed, total, httpResp, err := buffer.ProcessResponseAsRingBufferToEnd(httpResp, bufferSize)\nif err != nil {\n    return \"\", 0, httpResp, fmt.Errorf(\"failed to process log content: %w\", err)\n}\n\n// after - one bounded retry on transient body failure, fresh URL each time\nvar out string\nvar totalLines int\nfor attempt := range 2 {\n    u, _, e := client.Actions.GetWorkflowJobLogs(ctx, owner, repo, jobID, 1)\n    if e != nil {\n        return \"\", 0, nil, e\n    }\n    out, totalLines, httpResp, err = tryDownloadAndBuffer(ctx, u.String(), bufferSize)\n    if err == nil || attempt == 1 {\n        break\n    }\n}","handlingStrategy":"retry","validationCode":"// Before streaming: context live + body present\nif ctx.Err() != nil {\n    return ctx.Err()\n}\nif httpResp == nil || httpResp.Body == nil {\n    return errors.New(\"nothing to buffer\")\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n    if errors.Is(err, context.Canceled) {\n        return err\n    }\n    // body read broke mid-stream: fresh URL, one retry\n    return fetchAndBufferWithRetry(ctx, client, owner, repo, jobID, tailLines, 1)\n}","preventionTips":["Lower tail_lines for very large logs to shorten streaming time","Prefer bounded retry (1 attempt) over loops - fresh signed URL each time","Monitor for one specific job consistently failing (abnormally large log)","Check proxy idle timeouts for long transfers"],"tags":["io","streaming","retry","logs","go"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}