{"record":{"id":"5f7d0561ffd258f8","repo":"moonD4rk/HackBrowserData","slug":"unknown-browser-kind-d","errorCode":null,"errorMessage":"unknown browser kind: %d","messagePattern":"unknown browser kind: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"browser/browser.go","lineNumber":160,"sourceCode":"\t\t\treturn nil, err\n\t\t}\n\t\tif b == nil {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn b, nil\n\n\tcase types.Safari:\n\t\tb, err := safari.NewBrowser(cfg)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif b == nil {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn b, nil\n\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown browser kind: %d\", cfg.Kind)\n\t}\n}\n\n// ListBrowsers returns sorted keys of all platform browsers.\nfunc ListBrowsers() []string {\n\tvar l []string\n\tfor _, cfg := range platformBrowsers() {\n\t\tl = append(l, cfg.Key)\n\t}\n\tsort.Strings(l)\n\treturn l\n}\n\n// Names returns a pipe-separated list of browser keys for CLI help text.\nfunc Names() string {\n\treturn strings.Join(ListBrowsers(), \"|\")\n}\n","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/moonD4rk/HackBrowserData/blob/0503d04d7a8d0379d060268a74f1b149e5a0aad5/browser/browser.go#L142-L178","documentation":"newBrowser builds a browser instance from a Config whose Kind field must be one of the known browser kinds. If Kind holds a value the switch doesn't handle (not a recognized Chromium/Firefox browser), construction fails with this error naming the numeric kind. It indicates a Config assembled with an invalid or out-of-range Kind.","triggerScenarios":"Calling newBrowser (directly or via discoverFromConfigs or BuildFromDump) with a Config whose Kind is an unregistered browser kind value — falls into the switch's default branch.","commonSituations":"Constructing browser.Config manually with a guessed Kind constant, a dump file declaring an unrecognized browser kind, or an enum added upstream but not handled in this build's switch.","solutions":["Use a Kind constant defined by the browser package instead of a raw integer.","Check the numeric value against the browser kind enum in browser/browser.go and pick a supported one.","If the browser genuinely isn't supported, don't construct a Config for it — filter it out of discover results.","Update the library if a new browser kind needs support in the switch."],"exampleFix":"// before\ncfg := browser.Config{Kind: 99, Name: \"mybrowser\"}\nb, err := browser.NewBrowser(cfg)\n// after\ncfg := browser.Config{Kind: browser.Chrome, Name: \"chrome\"}\nb, err := browser.NewBrowser(cfg)","handlingStrategy":"validation","validationCode":"switch cfg.Kind {\ncase browser.Chrome, browser.Firefox /* supported kinds */ :\n    // ok\ndefault:\n    return fmt.Errorf(\"unsupported browser kind %d\", cfg.Kind)\n}","typeGuard":null,"tryCatchPattern":"b, err := browser.NewBrowser(cfg)\nif err != nil && strings.HasPrefix(err.Error(), \"unknown browser kind\") {\n    return nil, fmt.Errorf(\"kind %d unsupported in this build: %w\", cfg.Kind, err)\n}","preventionTips":["Only use exported Kind constants from the browser package.","Filter discovered configs to supported kinds before constructing.","Keep Config construction centralized so raw integers never reach Kind."],"tags":["browser","config","enum","invalid-argument"],"backgroundTag":"invalid-enum-value","analyzedSha":"0503d04d7a8d0379d060268a74f1b149e5a0aad5","analyzedAt":"2026-09-06T13:38:28.707Z","contentChangedAt":"2026-09-06T13:38:28.707Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}