chenhg5/cc-connect · error
run_as_user is not supported on Windows
Error message
run_as_user is not supported on Windows
What it means
The Windows build of VerifyRunAsUserCheap always fails with this error because run_as_user isolation depends on sudo, which does not exist on Windows. The empty-runAsUser case returns nil (nothing to verify), but any real user yields this unsupported-platform error. It mirrors the Unix implementation's signature so callers need no build-tag branching.
Source
Thrown at core/runas_windows.go:55
// 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)
Solutions
- Remove the run_as_user setting from config.toml on Windows hosts.
- Deploy cc-connect on a Unix-like OS when run_as_user isolation is required.
- Check runtime.GOOS before configuring run_as_user and warn instead of attempting verification.
Example fix
// before
if err := core.VerifyRunAsUserCheap(ctx, runner, cfg.RunAsUser); err != nil {
return err
}
// after
if runtime.GOOS == "windows" {
return fmt.Errorf("run_as_user is not supported on Windows; unset it in config.toml")
}
if err := core.VerifyRunAsUserCheap(ctx, runner, cfg.RunAsUser); err != nil {
return err
} Defensive patterns
Strategy: validation
Validate before calling
if runtime.GOOS == "windows" && cfg.RunAsUser != "" {
return errors.New("run_as_user cannot be used on Windows; remove it from config")
} Try / catch
if err := core.VerifyRunAsUserCheap(ctx, runner, user); err != nil {
if runtime.GOOS == "windows" {
return fmt.Errorf("isolation unsupported here: %w", err)
}
return err
} Prevention
- Validate at config-load time that run_as_user is only set on Unix hosts.
- Reuse configs across OSes only after stripping OS-specific keys.
- Surface the unsupported-platform error in doctor output for Windows users.
When it happens
Trigger: Calling VerifyRunAsUserCheap with a non-empty runAsUser on a Windows build (core/runas_windows.go:55), e.g. from newClaudeSession during session creation with run_as_user configured.
Common situations: Config copied from a Linux deployment (containing run_as_user) run on Windows; unit/integration tests on a windows runner; users attempting sandboxed agents on a Windows desktop.
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
- VerifyRunAsUserCheap: runAsUser is empty
- RunIsolationProbe: RunAsUser is empty
- PreflightRunAsUser: RunAsUser is empty
- project %q: target user %q can run passwordless sudo. The ru
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/a05cfb6cc0f49b30.
Report an issue: GitHub.