{"record":{"id":"2758acd89b8374d9","repo":"grafana/k6","slug":"failed-to-parse-json-config-w","errorCode":null,"errorMessage":"failed to parse JSON config: %w","messagePattern":"failed to parse JSON config: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/secretsource/url/url.go","lineNumber":512,"sourceCode":"\n\treturn cfg, nil\n}\n\nfunc loadConfigFromFile(configPath string, fs fsext.Fs) (extConfig, error) {\n\tfile, err := fs.Open(configPath)\n\tif err != nil {\n\t\treturn extConfig{}, fmt.Errorf(\"failed to open config file: %w\", err)\n\t}\n\tdefer func() { _ = file.Close() }()\n\n\tconfigData, err := io.ReadAll(file)\n\tif err != nil {\n\t\treturn extConfig{}, fmt.Errorf(\"failed to read config file: %w\", err)\n\t}\n\n\tvar fileCfg extConfig\n\tif err := json.Unmarshal(configData, &fileCfg); err != nil {\n\t\treturn extConfig{}, fmt.Errorf(\"failed to parse JSON config: %w\", err)\n\t}\n\n\treturn fileCfg, nil\n}\n\nfunc validateURLTemplate(urlTemplate string) error {\n\tif urlTemplate == \"\" {\n\t\treturn errMissingURLTemplate\n\t}\n\n\t// Require {key} placeholder to differentiate between secrets\n\tif !strings.Contains(urlTemplate, \"{key}\") {\n\t\treturn errors.New(\"urlTemplate must contain {key} placeholder\")\n\t}\n\n\t// Replace {key} placeholder with a dummy value for validation\n\ttestURL := strings.ReplaceAll(urlTemplate, \"{key}\", \"test\")\n\tparsedURL, err := url.Parse(testURL)","sourceCodeStart":494,"sourceCodeEnd":530,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/secretsource/url/url.go#L494-L530","documentation":"The config file contents are unmarshaled into extConfig with encoding/json; a syntax error, wrong types, or non-JSON content produces this wrapped error. The file exists but is not a valid JSON config for the url secret source.","triggerScenarios":"Thrown at internal/secretsource/url/url.go:512 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Validate the JSON syntax of the config file","Match the expected field names and types (strings, numbers, durations as strings)"],"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-14T05:17:10.506Z"}