{"record":{"id":"c61dbb771db4437e","repo":"grafana/k6","slug":"maxretries-must-be-non-negative","errorCode":null,"errorMessage":"maxRetries must be non-negative","messagePattern":"maxRetries must be non-negative","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/secretsource/url/url.go","lineNumber":595,"sourceCode":"\t// Validate required fields and value constraints\n\tif err := validateURLTemplate(config.URLTemplate); err != nil {\n\t\treturn err\n\t}\n\n\tif config.Timeout.Duration <= 0 {\n\t\treturn errors.New(\"timeout must be greater than 0\")\n\t}\n\n\tif config.RequestsPerMinuteLimit.Int64 <= 0 {\n\t\treturn errors.New(\"requestsPerMinuteLimit must be greater than 0\")\n\t}\n\n\tif config.RequestsBurst.Int64 <= 0 {\n\t\treturn errors.New(\"requestsBurst must be greater than 0\")\n\t}\n\n\tif config.MaxRetries.Int64 < 0 {\n\t\treturn errors.New(\"maxRetries must be non-negative\")\n\t}\n\n\tif config.RetryBackoff.Duration <= 0 {\n\t\treturn errors.New(\"retryBackoff must be greater than 0\")\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":577,"sourceCodeEnd":604,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/secretsource/url/url.go#L577-L604","documentation":"validateConfig() checks that maxRetries for the url secret source is not negative. Unlike the other numeric fields, 0 is a legal value (meaning 'do not retry'), so only values below zero are rejected. The error surfaces at startup during config validation.","triggerScenarios":"Setting K6_SECRET_SOURCE_URL_MAX_RETRIES='-1' (or any negative integer), or \"maxRetries\": -3 in the JSON/inline config.","commonSituations":"Using -1 as an 'infinite retries' convention from other tools; sign errors when computing the value; flipping the meaning of the field ('retries' vs 'attempts').","solutions":["Set maxRetries to 0 to disable retries, or to a small positive number such as 3","Check the sign of computed values before exporting them to env vars","Remember the field counts retries, not total attempts"],"exampleFix":"# before\nK6_SECRET_SOURCE_URL_MAX_RETRIES='-1'\n\n# after\nK6_SECRET_SOURCE_URL_MAX_RETRIES='0'","handlingStrategy":"validation","validationCode":"const retries = Number(process.env.K6_SECRET_SOURCE_URL_MAX_RETRIES);\nif (process.env.K6_SECRET_SOURCE_URL_MAX_RETRIES && retries < 0) {\n  throw new Error('maxRetries must be >= 0');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use 0 (not -1) to disable retries","Remember the field counts retries, not total attempts","Check signs when deriving the value from other numbers"],"tags":["config","secrets","retries","validation","startup"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}