{"record":{"id":"a05cfb6cc0f49b30","repo":"chenhg5/cc-connect","slug":"run-as-user-is-not-supported-on-windows","errorCode":null,"errorMessage":"run_as_user is not supported on Windows","messagePattern":"run_as_user is not supported on Windows","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/runas_windows.go","lineNumber":55,"sourceCode":"// SudoRunner is a stub interface on Windows for API compatibility.\ntype SudoRunner interface {\n\tRun(ctx context.Context, args ...string) ([]byte, error)\n}\n\n// ExecSudoRunner is a stub on Windows.\ntype ExecSudoRunner struct{}\n\n// Run always fails on Windows.\nfunc (ExecSudoRunner) Run(ctx context.Context, args ...string) ([]byte, error) {\n\treturn nil, errors.New(\"sudo is not supported on Windows\")\n}\n\n// VerifyRunAsUserCheap always fails on Windows.\nfunc VerifyRunAsUserCheap(_ context.Context, _ SudoRunner, runAsUser string) error {\n\tif runAsUser == \"\" {\n\t\treturn nil\n\t}\n\treturn errors.New(\"run_as_user is not supported on Windows\")\n}\n","sourceCodeStart":37,"sourceCodeEnd":57,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/runas_windows.go#L37-L57","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nif err := core.VerifyRunAsUserCheap(ctx, runner, cfg.RunAsUser); err != nil {\n    return err\n}\n// after\nif runtime.GOOS == \"windows\" {\n    return fmt.Errorf(\"run_as_user is not supported on Windows; unset it in config.toml\")\n}\nif err := core.VerifyRunAsUserCheap(ctx, runner, cfg.RunAsUser); err != nil {\n    return err\n}","handlingStrategy":"validation","validationCode":"if runtime.GOOS == \"windows\" && cfg.RunAsUser != \"\" {\n    return errors.New(\"run_as_user cannot be used on Windows; remove it from config\")\n}","typeGuard":null,"tryCatchPattern":"if err := core.VerifyRunAsUserCheap(ctx, runner, user); err != nil {\n    if runtime.GOOS == \"windows\" {\n        return fmt.Errorf(\"isolation unsupported here: %w\", err)\n    }\n    return err\n}","preventionTips":["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."],"tags":["windows","platform","sudo","isolation","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"}