{"record":{"id":"46cc9cda626f1ba4","repo":"grafana/k6","slug":"secret-value-at-path-q-is-not-a-string-got-s","errorCode":null,"errorMessage":"secret value at path %q is not a string (got %s)","messagePattern":"secret value at path %q is not a string \\(got (.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/secretsource/url/url.go","lineNumber":260,"sourceCode":"\t}\n\n\tif len(data) > maxSecretSize {\n\t\treturn \"\", fmt.Errorf(\"secret response exceeds maximum size of %d bytes\", maxSecretSize)\n\t}\n\n\tif responsePath == \"\" {\n\t\t// If no path specified, assume response body is the secret\n\t\treturn string(data), nil\n\t}\n\n\tresult := gjson.GetBytes(data, responsePath)\n\n\tif !result.Exists() {\n\t\treturn \"\", fmt.Errorf(\"path %q not found in response\", responsePath)\n\t}\n\n\tif result.Type != gjson.String {\n\t\treturn \"\", fmt.Errorf(\"secret value at path %q is not a string (got %s)\", responsePath, result.Type)\n\t}\n\n\treturn result.String(), nil\n}\n\n// retry retries to execute a provided function until it succeeds or the maximum\n// number of attempts is hit. It waits with exponential backoff between attempts.\n// The backoff calculation is: wait = (base ^ attempt) + random jitter up to 1 second.\n// The do function returns an error and a boolean indicating if the error is retryable.\nfunc retry(\n\tctx context.Context,\n\tattempts int,\n\tbaseBackoff time.Duration,\n\tlogger logrus.FieldLogger,\n\tdo func() (error, bool),\n) error {\n\tr := rand.New(rand.NewSource(time.Now().UnixNano())) //nolint:gosec\n","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/secretsource/url/url.go#L242-L278","documentation":"When the gjson path does resolve, the module only accepts string values; if result.Type is not gjson.String (number, bool, null, object...) this error reports the actual type. The secret source requires the selected JSON field to be a string.","triggerScenarios":"Thrown at internal/secretsource/url/url.go:260 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Point responsePath at a string field in the response","Change the service to return the secret as a JSON string"],"exampleFix":null,"handlingStrategy":"validation","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-14T00:17:10.932Z"}