{"record":{"id":"3128c99b0f63ae2d","repo":"grafana/k6","slug":"rate-limiter-error-w","errorCode":null,"errorMessage":"rate limiter error: %w","messagePattern":"rate limiter error: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/secretsource/url/url.go","lineNumber":164,"sourceCode":"\t}, nil\n}\n\ntype urlSecrets struct {\n\tconfig     extConfig\n\thttpClient *http.Client\n\tlimiter    limiter\n\tlogger     logrus.FieldLogger\n}\n\nfunc (us *urlSecrets) Description() string {\n\treturn \"URL-based secret source\"\n}\n\nfunc (us *urlSecrets) Get(key string) (string, error) {\n\tctx := context.Background()\n\n\tif err := us.limiter.Wait(ctx); err != nil {\n\t\treturn \"\", fmt.Errorf(\"rate limiter error: %w\", err)\n\t}\n\n\tvar secret string\n\t// MaxRetries is the number of retries, so total attempts = retries + 1\n\tmaxAttempts := int(us.config.MaxRetries.Int64) + 1\n\tbackoff := time.Duration(us.config.RetryBackoff.Duration)\n\n\terr := retry(ctx, maxAttempts, backoff, us.logger, func() (error, bool) {\n\t\t// Replace {key} placeholder in URL template\n\t\turl := strings.ReplaceAll(us.config.URLTemplate, \"{key}\", key)\n\n\t\treq, err := http.NewRequestWithContext(ctx, us.config.Method.String, url, nil)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create request: %w\", err), true\n\t\t}\n\n\t\t// Add headers\n\t\tfor k, v := range us.config.Headers {","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/secretsource/url/url.go#L146-L182","documentation":"urlSecrets.Get respects its rate limiter before fetching a secret; if limiter.Wait fails it is almost always because the context was cancelled (k6 shutting down) rather than throttling. The secret lookup is aborted and the error is surfaced to the script.","triggerScenarios":"Thrown at internal/secretsource/url/url.go:164 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped error; if it's a context cancellation, avoid cancelling during secret fetches","Review requestsPerMinuteLimit and requestsBurst settings for consistency"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}