{"record":{"id":"62effe1d1bee0dea","repo":"twpayne/chezmoi","slug":"empty-directory-name","errorCode":null,"errorMessage":"empty directory name","messagePattern":"empty directory name","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/chezmoi/attr.go","lineNumber":11,"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","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/twpayne/chezmoi/blob/f901167e4685db90da56d6a2a19df642cb3e0247/internal/chezmoi/attr.go#L1-L29","documentation":"errEmptyDirName is a sentinel error in chezmoi's source attribute parsing (internal/chezmoi/attr.go:11). parseDirAttr returns it when the directory name being parsed is an empty string. Directory names in chezmoi's source state encode target attributes (prefixes, literal markers), so an empty name cannot be interpreted as any valid target path.","triggerScenarios":"Calling parseDirAttr with an empty string as the directory name, e.g. when walking a source state where a directory entry yields a zero-length base name.","commonSituations":"Corrupted or hand-edited source state directories; filesystem oddities producing empty base names; programmatic construction of source state entries without validation.","solutions":["Check the source state directory entries; find and fix or remove the entry with an empty base name.","Validate directory names are non-empty before passing them to parseDirAttr orchezmoi source-state APIs.","Re-create the affected source directory with a valid attribute-encoded name."],"exampleFix":"// before\nchezmoi.ParseDirAttr(\"\")\n// after\nif name == \"\" {\n    return fmt.Errorf(\"cannot parse dir attr: name is empty\")\n}\nattr := chezmoi.ParseDirAttr(name)","handlingStrategy":"validation","validationCode":"if name == \"\" {\n    return fmt.Errorf(\"skipping source dir entry: empty name\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Skip entries with empty basenames before parsing attributes.","Keep source state directories managed by chezmoi; avoid manual edits.","Validate source directory contents after restores or syncs."],"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"}