{"record":{"id":"01ff172441bcea4a","repo":"twpayne/chezmoi","slug":"empty-filename","errorCode":null,"errorMessage":"empty filename","messagePattern":"empty filename","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/chezmoi/attr.go","lineNumber":12,"sourceCode":"package chezmoi\n\nimport (\n\t\"errors\"\n\t\"io/fs\"\n\t\"log/slog\"\n\t\"strings\"\n)\n\nvar (\n\terrEmptyDirName  = errors.New(\"empty directory name\")\n\terrEmptyFilename = errors.New(\"empty filename\")\n)\n\n// A SourceFileTargetType is a the type of a target represented by a file in the\n// source state. A file in the source state can represent a file, script, or\n// symlink in the target state.\ntype SourceFileTargetType int\n\n// Source file types.\nconst (\n\tSourceFileTypeCreate SourceFileTargetType = iota\n\tSourceFileTypeFile\n\tSourceFileTypeModify\n\tSourceFileTypeRemove\n\tSourceFileTypeScript\n\tSourceFileTypeSymlink\n)\n\nvar sourceFileTypeStrs = map[SourceFileTargetType]string{","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/twpayne/chezmoi/blob/f901167e4685db90da56d6a2a19df642cb3e0247/internal/chezmoi/attr.go#L1-L30","documentation":"errEmptyFilename is a sentinel error in internal/chezmoi/attr.go:12. parseFileAttr returns it when the file name being parsed is an empty string. File names in the source state carry target attributes (immutable, encrypted, script type prefixes), so an empty name is not a valid source file entry.","triggerScenarios":"Calling parseFileAttr with an empty string, e.g. when enumerating source files and a basename is empty.","commonSituations":"Manually renamed or corrupted files in ~/.local/share/chezmoi; scripts generating source entries with empty names; misconfigured source directory templates.","solutions":["Inspect the source directory and remove/fix entries with empty basenames.","Ensure file names are non-empty before calling parseFileAttr.","Use a properly prefixed file name (e.g. run_, exact_, etc.) so attributes parse correctly."],"exampleFix":"// before\nattr := chezmoi.ParseFileAttr(name)\n// after\nif name == \"\" {\n    return nil, errors.New(\"file name is empty\")\n}\nattr := chezmoi.ParseFileAttr(name)","handlingStrategy":"validation","validationCode":"if name == \"\" {\n    return fmt.Errorf(\"skipping source file entry: empty name\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never create files with empty names in the source state.","Run `chezmoi doctor` to detect source state anomalies.","Validate generated source entry names in scripts before writing."],"tags":["source-state","parsing","validation"],"backgroundTag":"empty-name-input","analyzedSha":"f901167e4685db90da56d6a2a19df642cb3e0247","analyzedAt":"2026-09-01T18:16:41.508Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}