{"record":{"id":"c2f4f5ecae509056","repo":"projectdiscovery/katana","slug":"invalid-group-id","errorCode":null,"errorMessage":"invalid group ID","messagePattern":"invalid group ID","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/engine/headless/browser/browser.go","lineNumber":397,"sourceCode":"\t\t\t// Use user-provided data directory (preserve sessions/cookies)\n\t\t\ttempDir = l.opts.UserDataDir\n\t\t\tshouldCleanupTempDir = false\n\t\t} else if l.opts.ChromeUser != nil {\n\t\t\tvar err error\n\t\t\ttempDir, err = os.MkdirTemp(l.opts.ChromeUser.HomeDir, \"chrome-data-*\")\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"could not create temporary chrome data directory\")\n\t\t\t}\n\n\t\t\tuid, err := strconv.Atoi(l.opts.ChromeUser.Uid)\n\t\t\tif err != nil {\n\t\t\t\t_ = os.RemoveAll(tempDir)\n\t\t\t\treturn nil, errors.Wrap(err, \"invalid user ID\")\n\t\t\t}\n\t\t\tgid, err := strconv.Atoi(l.opts.ChromeUser.Gid)\n\t\t\tif err != nil {\n\t\t\t\t_ = os.RemoveAll(tempDir)\n\t\t\t\treturn nil, errors.Wrap(err, \"invalid group ID\")\n\t\t\t}\n\t\t\tif err := os.Chown(tempDir, uid, gid); err != nil {\n\t\t\t\t_ = os.RemoveAll(tempDir)\n\t\t\t\treturn nil, errors.Wrap(err, \"could not change ownership of chrome data directory\")\n\t\t\t}\n\t\t\tshouldCleanupTempDir = true\n\t\t} else {\n\t\t\tvar err error\n\t\t\ttempDir, err = os.MkdirTemp(\"\", \"katana-chrome-data-*\")\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"could not create temporary chrome data directory\")\n\t\t\t}\n\t\t\tshouldCleanupTempDir = true\n\t\t}\n\t}\n\n\tbrowser, err := l.launchBrowserWithDataDir(tempDir)\n\tif err != nil {","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/projectdiscovery/katana/blob/e3e742739c3746f085943ce918fb4e2b8daf6fe6/pkg/engine/headless/browser/browser.go#L379-L415","documentation":"Thrown when strconv.Atoi fails to parse ChromeUser.Gid. Same as the UID case but for the group ID: katana cannot chown the temp chrome data directory, so it deletes the directory and aborts page creation.","triggerScenarios":"ChromeUser.Gid is not a valid decimal integer string — empty or non-numeric — when the user.User struct was constructed manually or came from a directory service that did not populate Gid.","commonSituations":"Hand-built user.User missing Gid; NSS/LDAP lookups returning incomplete entries; pasting a uid into the Gid field with a typo; Windows hosts where user.Lookup semantics differ.","solutions":["Use user.Lookup(\"chrome\") / user.LookupGroup to obtain properly populated Uid and Gid strings.","Validate both fields up front with strconv.Atoi and fall back to ChromeUser=nil when invalid.","Correct the account's primary group in /etc/passwd (or the NSS/LDAP source) if Gid is missing.","If ownership change is not required, leave ChromeUser nil to use the default temp directory."],"exampleFix":"// before\nopts.ChromeUser = &user.User{Username: \"chrome\", Uid: \"1000\"} // Gid missing\n// after\nu, err := user.Lookup(\"chrome\")\nif err != nil {\n    return err\n}\nif _, err := strconv.Atoi(u.Gid); err != nil {\n    return fmt.Errorf(\"gid for user chrome is not numeric: %q\", u.Gid)\n}\nopts.ChromeUser = u","handlingStrategy":"validation","validationCode":"if opts.ChromeUser != nil {\n    if _, err := strconv.Atoi(opts.ChromeUser.Gid); err != nil {\n        return fmt.Errorf(\"ChromeUser.Gid %q is not numeric\", opts.ChromeUser.Gid)\n    }\n}","typeGuard":"func hasNumericGid(u *user.User) bool {\n    _, err := strconv.Atoi(u.Gid)\n    return err == nil\n}","tryCatchPattern":"page, err := l.createBrowserPageFunc(...)\nif err != nil && strings.Contains(err.Error(), \"invalid group ID\") {\n    l.opts.ChromeUser = nil // retry without dedicated chrome user\n    page, err = l.createBrowserPageFunc(...)\n}","preventionTips":["Use user.Lookup/user.LookupGroup to fill Gid correctly.","Check the account's primary group exists in /etc/passwd or the NSS backend.","Validate Gid numerically before assigning ChromeUser.","Skip ChromeUser entirely when no group-based isolation is required."],"tags":["configuration","parsing","chrome","user-accounts"],"backgroundTag":"invalid-uid-gid","analyzedSha":"e3e742739c3746f085943ce918fb4e2b8daf6fe6","analyzedAt":"2026-09-03T14:55:13.248Z","contentChangedAt":"2026-09-03T14:55:13.248Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}