router-for-me/CLIProxyAPI · error

unsupported operating system: %s

Error message

unsupported operating system: %s

What it means

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.

Source

Thrown at internal/browser/browser.go:68

	switch runtime.GOOS {
	case "darwin": // macOS
		cmd = exec.Command("open", url)
	case "windows":
		cmd = exec.Command("rundll32", "url.dll,FileProtocolHandler", url)
	case "linux":
		// Try common Linux browsers in order of preference
		browsers := []string{"xdg-open", "x-www-browser", "www-browser", "firefox", "chromium", "google-chrome"}
		for _, browser := range browsers {
			if _, err := exec.LookPath(browser); err == nil {
				cmd = exec.Command(browser, url)
				break
			}
		}
		if cmd == nil {
			return fmt.Errorf("no suitable browser found on Linux system")
		}
	default:
		return fmt.Errorf("unsupported operating system: %s", runtime.GOOS)
	}

	log.Debugf("Running command: %s %v", cmd.Path, cmd.Args[1:])
	err := cmd.Start()
	if err != nil {
		return fmt.Errorf("failed to start browser command: %w", err)
	}

	log.Debug("Successfully opened URL using platform-specific command")
	return nil
}

// IsAvailable checks if the system has a command available to open a web browser.
// It verifies the presence of necessary commands for the current operating system.
//
// Returns:
//   - true if a browser can be opened, false otherwise.
func IsAvailable() bool {

View on GitHub (pinned to 78f0c4079e)

Solutions

  1. Run on a supported OS (darwin, windows, linux)
  2. Use --no-browser (or equivalent) and complete OAuth by pasting the verification URI into a browser on another machine
  3. Extend the switch in internal/browser/browser.go for your GOOS (e.g. add a freebsd case using xdg-open/open)
  4. Alternatively replace the call with browser.IsAvailable() gating plus manual URL output

Example fix

// before
default:
    return fmt.Errorf("unsupported operating system: %s", runtime.GOOS)

// after (example: treat BSDs like Linux)
case "freebsd", "openbsd", "netbsd":
    if _, err := exec.LookPath("xdg-open"); err == nil {
        cmd = exec.Command("xdg-open", url)
    }
Defensive patterns

Strategy: validation

Validate before calling

if runtime.GOOS != "darwin" && runtime.GOOS != "windows" && runtime.GOOS != "linux" {
    // no browser command will be available; print URL for manual use
    log.Infof("unsupported platform %s for browser launch; open manually: %s", runtime.GOOS, url)
    return nil
}

Try / catch

if err := browser.OpenURL(url); err != nil {
    if strings.Contains(err.Error(), "unsupported operating system") {
        log.Infof("open this URL manually: %s", url)
        return nil // non-fatal for OAuth flows
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: Cross-compiling for BSD variants; running under environments where GOOS reports an unsupported value; new Go ports not yet handled by the switch.

Related errors


AI-assisted analysis of router-for-me/CLIProxyAPI@78f0c4079e (2026-08-15). Data as JSON: /api/errors/0838051f91f8575d. Report an issue: GitHub.