{"record":{"id":"82d30ea009915aa1","repo":"grafana/k6","slug":"no-secret-source-for-type-q-for-configuration-q","errorCode":null,"errorMessage":"no secret source for type %q for configuration %q","messagePattern":"no secret source for type %q for configuration %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/root.go","lineNumber":514,"sourceCode":"\t\tUsage:       gs.Usage,\n\t}\n\n\tresult := make(map[string]secretsource.Source)\n\tfor _, line := range gs.Flags.SecretSource {\n\t\tt, config, ok := strings.Cut(line, \"=\")\n\t\tif !ok {\n\t\t\tif strings.TrimSpace(line) == \"\" {\n\t\t\t\treturn nil, fmt.Errorf(\"couldn't parse secret source configuration %q\", line)\n\t\t\t}\n\t\t\t// Allow any non-empty source type without explicit config — it will use\n\t\t\t// environment variables and built-in defaults.\n\t\t\tt = line\n\t\t\tconfig = \"\"\n\t\t}\n\t\tsecretSources := ext.Get(ext.SecretSourceExtension)\n\t\tfound, ok := secretSources[t]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"no secret source for type %q for configuration %q\", t, line)\n\t\t}\n\t\tc := found.Module.(secretsource.Constructor) //nolint:forcetypeassert\n\t\tparams := baseParams\n\t\tname, isDefault, config := extractNameAndDefault(config)\n\t\tif name == \"\" {\n\t\t\t// Default the name to the source type to avoid an empty-string key.\n\t\t\tname = t\n\t\t}\n\t\tparams.ConfigArgument = config\n\n\t\tsecretSource, err := c(params)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t_, alreadRegistered := result[name]\n\t\tif alreadRegistered {\n\t\t\treturn nil, fmt.Errorf(\"secret source for name %q already registered before configuration %q\", t, line)\n\t\t}","sourceCodeStart":496,"sourceCodeEnd":532,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/cmd/root.go#L496-L532","documentation":"The type before '=' in a --secret-source entry must match a registered secret source extension. Stock k6 registers only 'file', 'mock', and 'url' ('cloud' is special-cased and rejected separately with a dedicated message). An unknown type aborts startup, naming the bad type and echoing the full offending entry so trailing garbage is visible.","triggerScenarios":"--secret-source=vault=myvault (no such source in this binary); --secret-source=file, (trailing comma makes the parsed type 'file,'); using a type provided only by an xk6 extension build in a stock k6 binary; simple typos like fille=...","commonSituations":"Assuming k6 has built-in Vault/AWS Secrets Manager support; trailing commas from comma-separated config lists; teams sharing commands between a custom xk6 build and vanilla k6.","solutions":["Use a registered type: file, mock, or url — e.g. --secret-source=file=secrets.txt","Check for trailing commas or stray characters: the error echoes the exact entry; 'file,' is not 'file'","If you need vault/aws-sm/etc., build k6 with the xk6 extension providing it, or export the secrets to a file and use file=","Verify available sources with `k6 run --secret-source=nonexistent x.js` — the error lists what you asked for; consult docs for your build's registered sources"],"exampleFix":"# before\nk6 run --secret-source=vault=myvault script.js\n\n# after\nk6 run --secret-source=file=secrets.txt script.js","handlingStrategy":"validation","validationCode":"# check each secret source type against the sources this binary registers\nknown_sources=\"file mock url\"   # add your xk6 extension's sources here\nfor entry in \"$@\"; do\n  type=\"${entry%%=*}\"\n  found=0\n  for k in $known_sources; do [ \"$type\" = \"$k\" ] && found=1; done\n  [ \"$found\" = 1 ] || { echo \"unknown secret source type: $type\" >&2; exit 1; }\ndone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Document which secret sources your k6 build actually registers (stock: file, mock, url; 'cloud' is auto-only)","Lint comma-separated configs for trailing commas — 'file,' is parsed as a type name","Keep a naming convention and validate it in CI before invoking k6"],"tags":["k6","secrets","secret-source","extension","config"],"backgroundTag":"unknown-provider","analyzedSha":"8d06114777191d21ef885d05c5f8aa9e1ed838ae","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}