{"record":{"id":"ddab72b389f84e3c","repo":"projectdiscovery/nuclei","slug":"multiple-templates-found-for-path-s","errorCode":null,"errorMessage":"multiple templates found for path: %s","messagePattern":"multiple templates found for path: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/runner/lazy.go","lineNumber":78,"sourceCode":"\tstore, err := loader.New(cfg)\n\tif err != nil {\n\t\treturn nil, errkit.Wrap(err, \"failed to initialize dynamic auth templates store\")\n\t}\n\treturn store, nil\n}\n\n// GetLazyAuthFetchCallback returns a lazy fetch callback for auth secrets\nfunc GetLazyAuthFetchCallback(opts *AuthLazyFetchOptions) authx.LazyFetchSecret {\n\treturn func(d *authx.Dynamic) error {\n\t\ttmpls, err := opts.TemplateStore.LoadTemplates([]string{d.TemplatePath})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to load templates: %w\", err)\n\t\t}\n\t\tif len(tmpls) == 0 {\n\t\t\treturn fmt.Errorf(\"%w for path: %s\", disk.ErrNoTemplatesFound, d.TemplatePath)\n\t\t}\n\t\tif len(tmpls) > 1 {\n\t\t\treturn fmt.Errorf(\"multiple templates found for path: %s\", d.TemplatePath)\n\t\t}\n\t\tdata := map[string]interface{}{}\n\t\ttmpl := tmpls[0]\n\t\t// add args to tmpl here\n\t\tvars := map[string]interface{}{}\n\t\tmainCtx := context.Background()\n\t\tctx := scan.NewScanContext(mainCtx, contextargs.NewWithInput(mainCtx, d.Input))\n\n\t\tcliVars := map[string]interface{}{}\n\t\tif opts.ExecOpts.Options != nil {\n\t\t\t// gets variables passed from cli -v and -env-vars\n\t\t\tcliVars = generators.BuildPayloadFromOptions(opts.ExecOpts.Options)\n\t\t}\n\n\t\tfor _, v := range d.Variables {\n\t\t\t//  Check if the template has any env variables and expand them\n\t\t\tif strings.HasPrefix(v.Value, \"$\") {\n\t\t\t\tenv.ExpandWithEnv(&v.Value)","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/internal/runner/lazy.go#L60-L96","documentation":"LoadTemplates returned more than one template for the dynamic secret's single path (internal/runner/lazy.go:78); the callback requires exactly one template to execute for a dynamic secret, so ambiguity is an error. This occurs when TemplatePath is a directory or a glob-like value that expands to multiple template files.","triggerScenarios":"TemplatePath pointing at a directory containing several templates; wildcard characters in the path expanded by the loader; a file path that matches multiple indexed entries.","commonSituations":"Pointing dynamic secrets at a folder of auth templates instead of one file; copy-pasted configs that use glob patterns.","solutions":["Set TemplatePath to one specific .yaml template file","Remove glob/wildcard characters from the path","Split multi-template auth logic so each dynamic secret maps to exactly one template"],"exampleFix":"# before\n  template-path: auth/\n\n# after\n  template-path: auth/get-session.yaml","handlingStrategy":"validation","validationCode":"// ensure the path resolves to exactly one template file\nmatches, _ := filepath.Glob(d.TemplatePath)\nif strings.ContainsAny(d.TemplatePath, \"*?[\") || len(matches) != 1 {\n    return fmt.Errorf(\"template path %s must be one specific file\", d.TemplatePath)\n}","typeGuard":null,"tryCatchPattern":"if len(tmpls) > 1 {\n    return fmt.Errorf(\"path %s matched %d templates; point at a single .yaml file\", d.TemplatePath, len(tmpls))\n}","preventionTips":["Use concrete file paths, never directories or globs, for dynamic secrets","One auth template per dynamic secret","Document the expected shape of template-path in config examples"],"tags":["go","nuclei","auth-secrets","templates","path-resolution"],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}