chenhg5/cc-connect · error
sudo is not supported on Windows
Error message
sudo is not supported on Windows
What it means
ExecSudoRunner.Run is a Windows stub: sudo-based run_as_user isolation is only implemented for Unix-like systems, so any invocation on Windows returns this error unconditionally. It exists to keep the package compilable on Windows while making the unsupportedness explicit at runtime.
Solutions
- Run cc-connect on Linux/macOS where sudo isolation is supported.
- Remove run_as_user configuration on Windows hosts so sudo paths are never exercised.
- Gate the isolation feature on runtime.GOOS and skip with a warning on windows.
Example fix
// before
out, err := runner.Run(ctx, "-n", "-iu", user, "--", "/usr/bin/true")
// after
if runtime.GOOS == "windows" {
slog.Warn("run_as_user isolation is not supported on Windows; skipping")
return nil
}
out, err := runner.Run(ctx, "-n", "-iu", user, "--", "/usr/bin/true") Defensive patterns
Strategy: validation
Validate before calling
if runtime.GOOS == "windows" {
// skip or reject run_as_user configuration before any sudo call
} Try / catch
out, err := runner.Run(ctx, args...)
if err != nil && runtime.GOOS == "windows" {
slog.Warn("sudo unsupported on this platform", "err", err)
return nil, errSkipIsolation
} Prevention
- Do not configure run_as_user on Windows deployments.
- Feature-flag sudo isolation per OS in config validation.
- Add build-tag-aware tests so CI on Windows skips sudo paths.
When it happens
Trigger: Calling any SudoRunner-based path (isolation probe, preflight, session spawn with run_as_user) on a Windows build of cc-connect (core/runas_windows.go:47).
Common situations: Running cc-connect.exe with run_as_user configured; CI matrix builds executing Unix-targeted tests on windows-latest; developers porting tooling that assumed a POSIX host.
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
- run_as_user is not supported on Windows
- unsupported OS
- another cc-connect instance is already running
- another cc-connect instance is already running with config
- cannot convert lock path
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/7068516e0ea3f4ea.
Report an issue: GitHub.
Appendix: source
Thrown at core/runas_windows.go:47
// it before we get here) and delegates to exec.CommandContext.
func BuildSpawnCommand(ctx context.Context, _ SpawnOptions, name string, args ...string) *exec.Cmd {
return exec.CommandContext(ctx, name, args...)
}
// FilterEnvForSpawn on Windows is a no-op pass-through.
func FilterEnvForSpawn(env []string, _ SpawnOptions) []string { return env }
// SudoRunner is a stub interface on Windows for API compatibility.
type SudoRunner interface {
Run(ctx context.Context, args ...string) ([]byte, error)
}
// ExecSudoRunner is a stub on Windows.
type ExecSudoRunner struct{}
// Run always fails on Windows.
func (ExecSudoRunner) Run(ctx context.Context, args ...string) ([]byte, error) {
return nil, errors.New("sudo is not supported on Windows")
}
// VerifyRunAsUserCheap always fails on Windows.
func VerifyRunAsUserCheap(_ context.Context, _ SudoRunner, runAsUser string) error {
if runAsUser == "" {
return nil
}
return errors.New("run_as_user is not supported on Windows")
}
View on GitHub (pinned to 4000b2338a)