{"record":{"id":"13e138b6a49cea9b","repo":"grafana/k6","slug":"urltemplate-is-not-a-valid-url-w","errorCode":null,"errorMessage":"urlTemplate is not a valid URL: %w","messagePattern":"urlTemplate is not a valid URL: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/secretsource/url/url.go","lineNumber":532,"sourceCode":"\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)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"urlTemplate is not a valid URL: %w\", err)\n\t}\n\n\t// Require absolute URL with scheme\n\tif parsedURL.Scheme == \"\" {\n\t\treturn errors.New(\"urlTemplate must be an absolute URL with a scheme (e.g., https://...)\")\n\t}\n\n\treturn nil\n}\n\nfunc getConfig(arg string, fs fsext.Fs, env map[string]string) (extConfig, error) {\n\t// Start with defaults\n\tconfig := newConfig()\n\n\t// Apply environment variables\n\t// Order of precedence (lowest to highest):\n\t// 1. Defaults\n\t// 2. Environment variables","sourceCodeStart":514,"sourceCodeEnd":550,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/secretsource/url/url.go#L514-L550","documentation":"validateURLTemplate substituted the {key} placeholder with a dummy value and url.Parse rejected the result, meaning the configured urlTemplate is not syntactically a URL. This is a config validation guard: the template already passed the empty-string and placeholder checks, so the raw URL syntax itself is at fault.","triggerScenarios":"Thrown at internal/secretsource/url/url.go:532 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the urlTemplate value in the URL secret source config so it is an absolute URL with a scheme and host","Ensure the {key} placeholder remains in the template but the surrounding text parses as a URL (no stray spaces, brackets or invalid characters)"],"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"}