{"record":{"id":"49b2bab5edf67e11","repo":"kovidgoyal/kitty","slug":"no-user-matching-the-uid-v-found","errorCode":null,"errorMessage":"No user matching the UID: %#v found","messagePattern":"No user matching the UID: %#v found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"tools/utils/passwd.go","lineNumber":65,"sourceCode":"\t\treturn nil, err\n\t}\n\treturn ParsePasswdDatabase(UnsafeBytesToString(raw)), nil\n}\n\nvar passwd_err error\nvar passwd_database = sync.OnceValue(func() (ans map[string]PasswdEntry) {\n\tans, passwd_err = ParsePasswdFile(\"/etc/passwd\")\n\treturn\n})\n\nfunc PwdEntryForUid(uid string) (ans PasswdEntry, err error) {\n\tpwd := passwd_database()\n\tif passwd_err != nil {\n\t\treturn ans, passwd_err\n\t}\n\tans, found := pwd[uid]\n\tif !found {\n\t\treturn ans, fmt.Errorf(\"No user matching the UID: %#v found\", uid)\n\t}\n\treturn ans, nil\n}\n\nfunc parse_dscl_data(raw []byte) (ans map[string]PasswdEntry, err error) {\n\tvar pd []any\n\t_, err = plist.Unmarshal(raw, &pd)\n\tif err != nil {\n\t\treturn\n\t}\n\tans = make(map[string]PasswdEntry, 256)\n\tfor _, entry := range pd {\n\t\tif e, ok := entry.(map[string]any); ok {\n\t\t\titem := PasswdEntry{}\n\t\t\tfor key, a := range e {\n\t\t\t\tarray, ok := a.([]any)\n\t\t\t\tif !ok || len(array) == 0 || !strings.HasPrefix(key, \"dsAttrTypeNative:\") {\n\t\t\t\t\tcontinue","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/tools/utils/passwd.go#L47-L83","documentation":"PwdEntryForUid looks up a user by UID in the parsed passwd database and returns this error when the UID key is absent. It means the lookup itself succeeded but no passwd record matches that numeric UID.","triggerScenarios":"Passing a UID that exists as an integer but has no passwd entry (e.g. a deleted user, a container with a numeric-only owner like UID 999999, or NFS/ID-mapped mounts with unmapped UIDs).","commonSituations":"Files owned by stale UIDs after user deletion, minimal Docker images without the user defined, or macOS DSCL lookups where the user is not local. Callers resolving file ownership get this error.","solutions":["Verify the UID actually exists: run `getent passwd <uid>` or `id <uid>`.","If the user was deleted, restore it or chown the affected files to an existing user.","In containers, ensure the user is created in the image or run with `--user <uid>:<gid>` only when /etc/passwd has the entry.","Handle the error gracefully and fall back to displaying the raw numeric UID."],"exampleFix":"// before\nentry, err := utils.PwdEntryForUid(uid)\n// after\nentry, err := utils.PwdEntryForUid(uid)\nif err != nil {\n    name = strconv.FormatUint(uint64(uid), 10) // fall back to numeric owner\n}","handlingStrategy":"fallback","validationCode":"cmd := exec.Command(\"getent\", \"passwd\", strconv.FormatUint(uint64(uid), 10))\nif cmd.Run() != nil {\n    // no record; plan to use numeric fallback\n}","typeGuard":null,"tryCatchPattern":"entry, err := utils.PwdEntryForUid(uid)\nif err != nil {\n    name = strconv.FormatUint(uint64(uid), 10)\n    entry = utils.PasswdEntry{}\n}","preventionTips":["Cache passwd lookups and treat missing UIDs as non-fatal.","In containers, ensure /etc/passwd contains the run-as UID.","Fall back to numeric owner names when rendering file listings."],"tags":["go","passwd","uid","lookup"],"backgroundTag":"user-lookup-failed","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}