{"record":{"id":"d63588d5d5d5f662","repo":"kubernetes/kops","slug":"error-looking-up-user-q-v","errorCode":null,"errorMessage":"error looking up user %q: %v","messagePattern":"error looking up user %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/files_owner.go","lineNumber":43,"sourceCode":"\n\t\"k8s.io/klog/v2\"\n)\n\n// EnsureFileOwner will set the owner & group for a file.\n// Empty values for owner/group will leave the owner/group unchanged.\nfunc EnsureFileOwner(destPath string, owner string, groupName string) (bool, error) {\n\tchanged := false\n\tstat, err := os.Lstat(destPath)\n\tif err != nil {\n\t\treturn changed, fmt.Errorf(\"error getting file stat for %q: %v\", destPath, err)\n\t}\n\n\tactualUserID := int(stat.Sys().(*syscall.Stat_t).Uid)\n\tuserID := actualUserID\n\tif owner != \"\" {\n\t\tuser, err := LookupUser(owner) // user.Lookup(owner)\n\t\tif err != nil {\n\t\t\treturn changed, fmt.Errorf(\"error looking up user %q: %v\", owner, err)\n\t\t}\n\t\tif user == nil {\n\t\t\treturn changed, fmt.Errorf(\"user %q not found\", owner)\n\t\t}\n\t\tuserID = user.Uid\n\t}\n\n\tactualGroupID := int(stat.Sys().(*syscall.Stat_t).Gid)\n\tgroupID := actualGroupID\n\tif groupName != \"\" {\n\t\tgroup, err := LookupGroup(groupName)\n\t\tif err != nil {\n\t\t\treturn changed, fmt.Errorf(\"error looking up group %q: %v\", groupName, err)\n\t\t}\n\t\tif group == nil {\n\t\t\treturn changed, fmt.Errorf(\"group %q not found\", groupName)\n\t\t}\n\t\tgroupID = group.Gid","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/files_owner.go#L25-L61","documentation":"Thrown by EnsureFileOwner when LookupUser fails to resolve the configured owner name to a system user. The named user does not exist in /etc/passwd (or the equivalent lookup source) on the machine performing the write — a typo in the owner name, or the user is created later by another task.","triggerScenarios":"Thrown at upup/pkg/fi/files_owner.go:43 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}