github/github-mcp-server · error

failed to download logs: %w

Error message

failed to download logs: %w

What it means

Returned by downloadLogContent (pkg/github/actions.go:174) when http.Get(logURL) itself fails at the transport level - DNS resolution, TCP connect, TLS handshake, or connection reset before any response. Note it uses the default http.Client without the caller's context, so context cancellation surfaces as a transport error here rather than a clean ctx.Err().

Source

Thrown at pkg/github/actions.go:174

		result["message"] = "Job logs content retrieved successfully"
		result["original_length"] = originalLength
	} else {
		// Return just the URL
		result["logs_url"] = url.String()
		result["message"] = "Job logs are available for download"
		result["note"] = "The logs_url provides a download link for the individual job logs in plain text format. Use return_content=true to get the actual log content."
	}

	return result, resp, nil
}

func downloadLogContent(ctx context.Context, logURL string, tailLines int, maxLines int) (string, int, *http.Response, error) {
	prof := profiler.New(nil, profiler.IsProfilingEnabled())
	finish := prof.Start(ctx, "log_buffer_processing")

	httpResp, err := http.Get(logURL) //nolint:gosec
	if err != nil {
		return "", 0, httpResp, fmt.Errorf("failed to download logs: %w", err)
	}
	defer func() { _ = httpResp.Body.Close() }()

	if httpResp.StatusCode != http.StatusOK {
		return "", 0, httpResp, fmt.Errorf("failed to download logs: HTTP %d", httpResp.StatusCode)
	}

	bufferSize := min(tailLines, maxLines)

	processedInput, totalLines, httpResp, err := buffer.ProcessResponseAsRingBufferToEnd(httpResp, bufferSize)
	if err != nil {
		return "", 0, httpResp, fmt.Errorf("failed to process log content: %w", err)
	}

	lines := strings.Split(processedInput, "\n")
	if len(lines) > tailLines {
		lines = lines[len(lines)-tailLines:]
	}

View on GitHub (pinned to 0ea1f775a7)

Solutions

  1. Check HTTP(S)_PROXY environment variables in containers that require an outbound proxy
  2. Test reachability: curl -I <signed-url> from the same host
  3. Add the corporate CA to the system trust store if TLS interception is in play
  4. Retry - transport blips are usually transient, and each retry gets a fresh signed URL

Example fix

// before
httpResp, err := http.Get(logURL)
if err != nil {
    return "", 0, httpResp, fmt.Errorf("failed to download logs: %w", err)
}

// after - honor context cancellation and make transport errors retryable
req, err := http.NewRequestWithContext(ctx, http.MethodGet, logURL, nil)
if err != nil {
    return "", 0, nil, fmt.Errorf("bad log URL: %w", err)
}
httpResp, err := httpClient.Do(req)
if err != nil {
    if errors.Is(err, context.Canceled) {
        return "", 0, nil, err // caller abort, do not retry
    }
    return "", 0, nil, fmt.Errorf("failed to download logs (transient, retry): %w", err)
}
Defensive patterns

Strategy: retry

Validate before calling

// Pre-flight the log host before the tool call
if _, err := net.DialTimeout("tcp", "objects.githubusercontent.com:443", 3*time.Second); err != nil {
    return fmt.Errorf("no egress to log storage: %w", err)
}

Try / catch

if err != nil {
    var netErr net.Error
    if errors.As(err, &netErr) {
        time.Sleep(time.Second)
        return retryOnce() // transient transport failure
    }
    if certErr := (&tls.CertificateVerificationError{}); errors.As(err, &certErr) {
        return err // trust store problem: fix CA, do not retry
    }
    return err
}

Prevention

When it happens

Trigger: Fetching a signed objects.githubusercontent.com log URL when DNS fails, the connection is refused or reset, a TLS error occurs (including corporate MITM proxies with untrusted roots), or the environment has no egress to GitHub blob storage.

Common situations: Containers/CI runners without HTTPS proxy env vars set; corporate TLS interception with an internal CA not in the trust store; transient DNS flakiness; egress firewalls allowing api.github.com but blocking objects.githubusercontent.com.

Related errors


AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15). Data as JSON: /api/errors/ee703557630a04a3. Report an issue: GitHub.