grafana/k6 · error
secret response exceeds maximum size of %d bytes
Error message
secret response exceeds maximum size of %d bytes
What it means
The body returned by the remote secret endpoint exceeded the 24 KiB safety cap enforced by extractSecretFromResponse. Reading is deliberately limited (io.LimitReader with maxSecretSize+1) to prevent memory exhaustion from huge responses; seeing maxSecretSize+1 bytes means the response is larger than a secret should ever be.
Source
Thrown at internal/secretsource/url/url.go:245
// the interval of time after which a new token is replenished. In
// other words, the units are time unit/token.
tokenReplenishInterval := time.Minute / time.Duration(requestsPerMinuteLimit)
return rate.NewLimiter(rate.Every(tokenReplenishInterval), requestsBurst)
}
func extractSecretFromResponse(body io.Reader, responsePath string) (string, error) {
const maxSecretSize = 24 * 1024
// Limit reading to prevent memory exhaustion from large responses
limitedReader := io.LimitReader(body, maxSecretSize+1)
data, err := io.ReadAll(limitedReader)
if err != nil {
return "", fmt.Errorf("failed to read response body: %w", err)
}
if len(data) > maxSecretSize {
return "", fmt.Errorf("secret response exceeds maximum size of %d bytes", maxSecretSize)
}
if responsePath == "" {
// If no path specified, assume response body is the secret
return string(data), nil
}
result := gjson.GetBytes(data, responsePath)
if !result.Exists() {
return "", fmt.Errorf("path %q not found in response", responsePath)
}
if result.Type != gjson.String {
return "", fmt.Errorf("secret value at path %q is not a string (got %s)", responsePath, result.Type)
}
return result.String(), nilView on GitHub (pinned to 01ffac6f24)
Solutions
- Configure responsePath so only a small JSON field is extracted instead of the whole body
- Fix the service endpoint if it is returning an unexpectedly large payload
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/secretsource/url/url.go:245 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/6f553c2e6b0a9562.
Report an issue: GitHub.