{"record":{"id":"0838051f91f8575d","repo":"router-for-me/CLIProxyAPI","slug":"unsupported-operating-system-s","errorCode":null,"errorMessage":"unsupported operating system: %s","messagePattern":"unsupported operating system: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/browser/browser.go","lineNumber":68,"sourceCode":"\tswitch runtime.GOOS {\n\tcase \"darwin\": // macOS\n\t\tcmd = exec.Command(\"open\", url)\n\tcase \"windows\":\n\t\tcmd = exec.Command(\"rundll32\", \"url.dll,FileProtocolHandler\", url)\n\tcase \"linux\":\n\t\t// Try common Linux browsers in order of preference\n\t\tbrowsers := []string{\"xdg-open\", \"x-www-browser\", \"www-browser\", \"firefox\", \"chromium\", \"google-chrome\"}\n\t\tfor _, browser := range browsers {\n\t\t\tif _, err := exec.LookPath(browser); err == nil {\n\t\t\t\tcmd = exec.Command(browser, url)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif cmd == nil {\n\t\t\treturn fmt.Errorf(\"no suitable browser found on Linux system\")\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported operating system: %s\", runtime.GOOS)\n\t}\n\n\tlog.Debugf(\"Running command: %s %v\", cmd.Path, cmd.Args[1:])\n\terr := cmd.Start()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to start browser command: %w\", err)\n\t}\n\n\tlog.Debug(\"Successfully opened URL using platform-specific command\")\n\treturn nil\n}\n\n// IsAvailable checks if the system has a command available to open a web browser.\n// It verifies the presence of necessary commands for the current operating system.\n//\n// Returns:\n//   - true if a browser can be opened, false otherwise.\nfunc IsAvailable() bool {","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/browser/browser.go#L50-L86","documentation":"runtime.GOOS matched none of the platform cases (darwin/windows/linux) in browser.OpenURL, so no browser-launch command exists for this build. It is a build/platform support gap rather than a runtime environment issue.","triggerScenarios":"Compiling/running the binary on an OS outside {darwin, windows, linux}: e.g. freebsd, openbsd, solaris, or a GOOS like js/wasm (where present) — the switch's default fires.","commonSituations":"Cross-compiling for BSD variants; running under environments where GOOS reports an unsupported value; new Go ports not yet handled by the switch.","solutions":["Run on a supported OS (darwin, windows, linux)","Use --no-browser (or equivalent) and complete OAuth by pasting the verification URI into a browser on another machine","Extend the switch in internal/browser/browser.go for your GOOS (e.g. add a freebsd case using xdg-open/open)","Alternatively replace the call with browser.IsAvailable() gating plus manual URL output"],"exampleFix":"// before\ndefault:\n    return fmt.Errorf(\"unsupported operating system: %s\", runtime.GOOS)\n\n// after (example: treat BSDs like Linux)\ncase \"freebsd\", \"openbsd\", \"netbsd\":\n    if _, err := exec.LookPath(\"xdg-open\"); err == nil {\n        cmd = exec.Command(\"xdg-open\", url)\n    }","handlingStrategy":"validation","validationCode":"if runtime.GOOS != \"darwin\" && runtime.GOOS != \"windows\" && runtime.GOOS != \"linux\" {\n    // no browser command will be available; print URL for manual use\n    log.Infof(\"unsupported platform %s for browser launch; open manually: %s\", runtime.GOOS, url)\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := browser.OpenURL(url); err != nil {\n    if strings.Contains(err.Error(), \"unsupported operating system\") {\n        log.Infof(\"open this URL manually: %s\", url)\n        return nil // non-fatal for OAuth flows\n    }\n    return err\n}","preventionTips":["Gate browser launch on supported GOOS values at build time","Always render the verification URL as text so unsupported platforms can still complete auth","Extend internal/browser/browser.go when targeting a new OS"],"tags":["browser","platform","goos","portability"],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}