grafana/k6 · error

invalid status code %s provided

Error message

invalid status code %s provided

What it means

Returned by retryableStatusCodes while iterating the comma-separated retry code list: one entry failed to convert to a grpc codes.Code (unknown or misspelled code name).

Source

Thrown at internal/cloudapi/insights/client.go:281

			grpcRetry.BackoffExponentialWithJitter(backoffConfig.WaitBetween, backoffConfig.JitterFraction))
		callOptions = append(callOptions, backoff)
	}

	unaryInterceptor := grpcRetry.UnaryClientInterceptor(callOptions...)
	return unaryInterceptor, nil
}

func retryableStatusCodes(retryableStatusCodes string) ([]codes.Code, error) {
	if len(retryableStatusCodes) == 0 {
		return nil, fmt.Errorf("no retryable status codes provided")
	}

	statusCodes := strings.Split(retryableStatusCodes, ",")
	errorCodes := make([]codes.Code, len(statusCodes))
	for i, code := range statusCodes {
		err := errorCodes[i].UnmarshalJSON([]byte(code))
		if err != nil {
			return nil, fmt.Errorf("invalid status code %s provided", code)
		}
	}

	return errorCodes, nil
}

type perRPCCredentials struct {
	metadata                 map[string]string
	requireTransportSecurity bool
}

func newPerRPCCredentials(cfg ClientAuthConfig) perRPCCredentials {
	return perRPCCredentials{
		metadata: map[string]string{
			testRunIDHeader:     fmt.Sprintf("%d", cfg.TestRunID),
			authorizationHeader: fmt.Sprintf("Token %s", cfg.Token),
		},
		requireTransportSecurity: cfg.RequireTransportSecurity,

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Replace the invalid entry with a valid gRPC code name such as 'Unavailable', 'DeadlineExceeded', or 'Internal'
  2. Check the message for the offending token and fix or remove it
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/cloudapi/insights/client.go:281 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/0311a769191bd533. Report an issue: GitHub.