{"record":{"id":"7908a6c3b4e551b4","repo":"twpayne/chezmoi","slug":"s-unknown-entry-type","errorCode":null,"errorMessage":"%s: unknown entry type","messagePattern":"(.+?): unknown entry type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/chezmoi/entrytypeset.go","lineNumber":304,"sourceCode":"func (s *EntryTypeSet) Set(str string) error {\n\tif str == \"none\" {\n\t\ts.bits = EntryTypesNone\n\t\treturn nil\n\t}\n\treturn s.SetSlice(strings.Split(str, \",\"))\n}\n\n// SetSlice sets s from a []string.\nfunc (s *EntryTypeSet) SetSlice(ss []string) error {\n\tbits := EntryTypesNone\n\tfor i, element := range ss {\n\t\tif element == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\telement, exclude := strings.CutPrefix(element, \"no\")\n\t\tbit, ok := entryTypeBits[element]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"%s: unknown entry type\", element)\n\t\t}\n\t\tif i == 0 && exclude {\n\t\t\tbits = EntryTypesAll\n\t\t}\n\t\tif exclude {\n\t\t\tbits &^= bit\n\t\t} else {\n\t\t\tbits |= bit\n\t\t}\n\t}\n\ts.bits = bits\n\treturn nil\n}\n\n// String implements github.com/spf13/pflag.Value.String.\nfunc (s *EntryTypeSet) String() string {\n\tif s == nil {\n\t\treturn \"none\"","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/twpayne/chezmoi/blob/f901167e4685db90da56d6a2a19df642cb3e0247/internal/chezmoi/entrytypeset.go#L286-L322","documentation":"EntryTypeSet.SetSlice parses entry type strings like 'file', 'dir', 'symlink', optionally prefixed with 'no' to exclude. If an element is not a known entry type bit, this error names the unrecognized element. It guards the set from accepting invalid type names.","triggerScenarios":"Calling SetSlice (directly or via Set) with an element string not present in entryTypeBits, e.g. a typo like 'files', 'dirs', or an empty-to-nonempty element that isn't a valid type.","commonSituations":"Typo in .chezmoiignore or script-generated patterns using entry types, hand-written attribute strings in templates, version drift where an expected type name changed.","solutions":["Correct the element to a valid entry type (e.g. 'file', 'dir', 'symlink', 'remove', 'script', 'once')","Remove the invalid element from the slice","Check docs for the chezmoi version in use, as the accepted set of types may differ across versions"],"exampleFix":"// before\nentryTypeSet.SetSlice([]string{\"files\", \"dirs\"})\n\n// after\nentryTypeSet.SetSlice([]string{\"file\", \"dir\"})","handlingStrategy":"validation","validationCode":"validTypes := map[string]bool{\"file\":true,\"dir\":true,\"symlink\":true,\"remove\":true,\"script\":true}\nfor _, el := range elems {\n    name := strings.TrimPrefix(el, \"no\")\n    if !validTypes[name] { return fmt.Errorf(\"invalid entry type %q\", el) }\n}","typeGuard":null,"tryCatchPattern":"if err := set.SetSlice(elems); err != nil {\n    if strings.Contains(err.Error(), \"unknown entry type\") {\n        // report the invalid element from the error message\n    }\n}","preventionTips":["Use only documented entry type names, singular forms","Trim and drop empty elements before SetSlice","Consult the EntryTypeSet docs for your chezmoi version"],"tags":["go","parsing","entry-type","validation"],"backgroundTag":"unknown-entry-type","analyzedSha":"f901167e4685db90da56d6a2a19df642cb3e0247","analyzedAt":"2026-09-01T18:16:41.508Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}