{"record":{"id":"c598e5b1ea811582","repo":"goreleaser/goreleaser","slug":"input-q-invalid-template-w","errorCode":null,"errorMessage":"input %q: invalid template: %w","messagePattern":"input %q: invalid template: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pipe/sbom/sbom.go","lineNumber":305,"sourceCode":"\t\t}\n\t\textraEnvs = append(extraEnvs, renderedKeyValue)\n\n\t\tk, v, _ := strings.Cut(renderedKeyValue, \"=\")\n\t\tenv[k] = v\n\t}\n\n\tvar paths []string\n\tfor idx, sbom := range cfg.Documents {\n\t\tinput := expand(sbom, env)\n\t\tif !filepath.IsAbs(input) {\n\t\t\t// assume any absolute path is handled correctly and assume that any relative path is not already\n\t\t\t// adjusted to reference the dist path\n\t\t\tinput = filepath.Join(ctx.Config.Dist, input)\n\t\t}\n\n\t\tpath, err := templater.Apply(input)\n\t\tif err != nil {\n\t\t\treturn nil, nil, nil, fmt.Errorf(\"input %q: invalid template: %w\", input, err)\n\t\t}\n\n\t\tpath, err = filepath.Abs(path)\n\t\tif err != nil {\n\t\t\treturn nil, nil, nil, fmt.Errorf(\"unable to create artifact path %q: %w\", sbom, err)\n\t\t}\n\n\t\tprocPath, err := subprocessDistPath(ctx.Config.Dist, path)\n\t\tif err != nil {\n\t\t\treturn nil, nil, nil, fmt.Errorf(\"cannot determine document path for %q: %w\", path, err)\n\t\t}\n\n\t\textraEnvs = appendExtraEnv(fmt.Sprintf(\"document%d\", idx), procPath, extraEnvs, env)\n\t\tif idx == 0 {\n\t\t\textraEnvs = appendExtraEnv(\"document\", procPath, extraEnvs, env)\n\t\t}\n\n\t\tpaths = append(paths, procPath)","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/goreleaser/goreleaser/blob/f5edd7395693c0c6b501dc722d445d2e86af854d/internal/pipe/sbom/sbom.go#L287-L323","documentation":"The `input` of an SBOM configuration (the document to catalog, e.g. the archive or binary path) is rendered as a Go template and then made absolute. If the template cannot be applied, GoReleaser fails with `input %q: invalid template`. It wraps the underlying template error so the real cause is the inner message.","triggerScenarios":"The `input:` field of an sboms config contains template syntax that fails to render — bad syntax like `{{ .Version ` or a nonexistent field such as `{{.Artifact.Name}}` when not in scope.","commonSituations":"Overriding the default `{{ .ArtifactPath }}` input and making a typo; using fields only available in other pipes; quoting mistakes in YAML that inject stray braces.","solutions":["Correct the template expression in sboms.input, verifying field names against GoReleaser's template docs","If the default input is fine, remove the custom input so GoReleaser uses `{{ .ArtifactPath }}`","Run `goreleaser release --snapshot --debug` to see the wrapped template error detail"],"exampleFix":"// before\nsboms:\n  - artifacts: archive\n    input: \"{{ .ArtifactPathh }}\"\n// after\nsboms:\n  - artifacts: archive\n    input: \"{{ .ArtifactPath }}\"","handlingStrategy":"validation","validationCode":"// Validate custom sbom input templates before release\nfor _, s := range cfg.SBOMs {\n\tif s.Input != \"\" && strings.Contains(s.Input, \"{{\") {\n\t\tif _, err := tmpl.New(nil).Apply(s.Input); err != nil {\n\t\t\treturn fmt.Errorf(\"bad sbom input %q: %w\", s.Input, err)\n\t\t}\n\t}\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n\tvar terr *template.Error\n\tif errors.As(err, &terr) {\n\t\treturn fmt.Errorf(\"sbom input template error at line %d: %w\", terr.Line(), terr)\n\t}\n\treturn err\n}","preventionTips":["Prefer the default input ({{ .ArtifactPath }}) unless required","Keep input templates minimal — path only","Test rendered paths with a snapshot run","Run `goreleaser check` in CI"],"tags":["goreleaser","template","sbom"],"backgroundTag":"go-template-render-failed","analyzedSha":"f5edd7395693c0c6b501dc722d445d2e86af854d","analyzedAt":"2026-09-05T09:57:18.807Z","contentChangedAt":"2026-09-05T09:57:18.807Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}