{"record":{"id":"311e3918de8f98d9","repo":"chenhg5/cc-connect","slug":"unsupported-os-s","errorCode":null,"errorMessage":"unsupported OS: %s","messagePattern":"unsupported OS: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cc-connect/web.go","lineNumber":98,"sourceCode":"\nfunc openBrowser(rawURL string) error {\n\tswitch runtime.GOOS {\n\tcase \"darwin\":\n\t\treturn exec.Command(\"open\", rawURL).Start()\n\tcase \"linux\":\n\t\tif isWSL() {\n\t\t\treturn exec.Command(\"cmd.exe\", \"/c\", \"start\", rawURL).Start()\n\t\t}\n\t\t// On headless Linux, xdg-open is often unavailable.\n\t\t// Check early and return a clear error so the caller can print the URL.\n\t\tif _, err := exec.LookPath(\"xdg-open\"); err != nil {\n\t\t\treturn fmt.Errorf(\"xdg-open not found (headless server?): %w\", err)\n\t\t}\n\t\treturn exec.Command(\"xdg-open\", rawURL).Start()\n\tcase \"windows\":\n\t\treturn exec.Command(\"cmd\", \"/c\", \"start\", rawURL).Start()\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported OS: %s\", runtime.GOOS)\n\t}\n}\n\nfunc isWSL() bool {\n\tdata, err := os.ReadFile(\"/proc/version\")\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn strings.Contains(strings.ToLower(string(data)), \"microsoft\")\n}\n","sourceCodeStart":80,"sourceCodeEnd":109,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/web.go#L80-L109","documentation":"openBrowser switches on runtime.GOOS to decide how to launch a browser. It handles darwin (implied), windows, and linux; any other GOOS falls into the default branch and returns \"unsupported OS: %s\". This guards against platforms where no browser-opening mechanism is implemented.","triggerScenarios":"Running `cc-connect web` (runWeb → openBrowser) on a GOOS outside {linux, windows, darwin}: e.g. freebsd, openbsd, plan9, android, or ios builds.","commonSituations":"Cross-compiling/running cc-connect on FreeBSD or OpenBSD servers; experimentation on niche platforms; testing on an emulated non-mainstream OS.","solutions":["Run cc-connect web on a supported OS (linux, macOS, Windows) and open the printed URL there.","On BSD, set and export $BROWSER — but note current code still rejects non-linux/windows; open the URL manually instead.","Use SSH port forwarding from a supported desktop machine to reach the remote dashboard.","If you must support the platform, extend openBrowser's switch with a case for your OS (e.g. xdg-open or a BROWSER env fallback)."],"exampleFix":"// before\ndefault:\n    return fmt.Errorf(\"unsupported OS: %s\", runtime.GOOS)\n// after\ndefault:\n    if b := os.Getenv(\"BROWSER\"); b != \"\" {\n        return exec.Command(b, rawURL).Start()\n    }\n    return fmt.Errorf(\"unsupported OS: %s\", runtime.GOOS)","handlingStrategy":"validation","validationCode":"supported := map[string]bool{\"linux\": true, \"windows\": true, \"darwin\": true}\nif !supported[runtime.GOOS] {\n    fmt.Printf(\"Browser auto-open unsupported on %s; open the URL manually\\n\", runtime.GOOS)\n}","typeGuard":null,"tryCatchPattern":"if err := openBrowser(url); err != nil {\n    if strings.HasPrefix(err.Error(), \"unsupported OS\") {\n        fmt.Println(\"Open the dashboard URL manually:\", url)\n    }\n}","preventionTips":["Run cc-connect web only on linux/windows/darwin hosts","On BSDs or niche platforms, treat the printed URL as the primary interface","Gate auto-open behind a flag (e.g. --no-browser) in scripts for portability"],"tags":["browser","platform","unsupported"],"backgroundTag":"unsupported-platform","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}