chenhg5/cc-connect · error
unsupported OS: %s
Error message
unsupported OS: %s
What it means
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.
Source
Thrown at cmd/cc-connect/web.go:98
func openBrowser(rawURL string) error {
switch runtime.GOOS {
case "darwin":
return exec.Command("open", rawURL).Start()
case "linux":
if isWSL() {
return exec.Command("cmd.exe", "/c", "start", rawURL).Start()
}
// On headless Linux, xdg-open is often unavailable.
// Check early and return a clear error so the caller can print the URL.
if _, err := exec.LookPath("xdg-open"); err != nil {
return fmt.Errorf("xdg-open not found (headless server?): %w", err)
}
return exec.Command("xdg-open", rawURL).Start()
case "windows":
return exec.Command("cmd", "/c", "start", rawURL).Start()
default:
return fmt.Errorf("unsupported OS: %s", runtime.GOOS)
}
}
func isWSL() bool {
data, err := os.ReadFile("/proc/version")
if err != nil {
return false
}
return strings.Contains(strings.ToLower(string(data)), "microsoft")
}
View on GitHub (pinned to 4000b2338a)
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).
Example fix
// before
default:
return fmt.Errorf("unsupported OS: %s", runtime.GOOS)
// after
default:
if b := os.Getenv("BROWSER"); b != "" {
return exec.Command(b, rawURL).Start()
}
return fmt.Errorf("unsupported OS: %s", runtime.GOOS) Defensive patterns
Strategy: validation
Validate before calling
supported := map[string]bool{"linux": true, "windows": true, "darwin": true}
if !supported[runtime.GOOS] {
fmt.Printf("Browser auto-open unsupported on %s; open the URL manually\n", runtime.GOOS)
} Try / catch
if err := openBrowser(url); err != nil {
if strings.HasPrefix(err.Error(), "unsupported OS") {
fmt.Println("Open the dashboard URL manually:", url)
}
} Prevention
- 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
When it happens
Trigger: Running `cc-connect web` (runWeb → openBrowser) on a GOOS outside {linux, windows, darwin}: e.g. freebsd, openbsd, plan9, android, or ios builds.
Common situations: Cross-compiling/running cc-connect on FreeBSD or OpenBSD servers; experimentation on niche platforms; testing on an emulated non-mainstream OS.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- sudo is not supported on Windows
- run_as_user is not supported on Windows
- operation not supported by this platform
- xdg-open not found (headless server?): %w
- project %q has no yuanbao platform
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/311e3918de8f98d9.
Report an issue: GitHub.