chenhg5/cc-connect · error

config: %s.run_as_user is only supported on Linux/macOS

Error message

config: %s.run_as_user is only supported on Linux/macOS

What it means

A config validation error from validateRunAsUser: run_as_user is configured but the platform is Windows, where the runuser-style privilege drop mechanism is not implemented. The feature is Linux/macOS only, so config load aborts rather than silently ignoring the setting.

Source

Thrown at config/config.go:69

	"SUDO_COMMAND":          true,
}

func validateRunAsEnv(prefix string, envVars []string) error {
	for _, v := range envVars {
		name := strings.TrimSpace(v)
		if dangerousEnvVars[strings.ToUpper(name)] {
			return fmt.Errorf("config: %s.run_as_env must not include dangerous variable %q", prefix, name)
		}
	}
	return nil
}

func validateRunAsUser(prefix, name string) error {
	if name == "" {
		return nil
	}
	if runtime.GOOS == "windows" {
		return fmt.Errorf("config: %s.run_as_user is only supported on Linux/macOS", prefix)
	}
	if name == "root" || name == "0" {
		return fmt.Errorf("config: %s.run_as_user must not be root", prefix)
	}
	if !isValidRunAsUserName(name) {
		return fmt.Errorf("config: %s.run_as_user %q contains invalid characters (allowed: a-z, A-Z, 0-9, -, _, .; must start with a letter or underscore)", prefix, name)
	}
	return nil
}

// configMu serializes read-modify-write cycles to prevent lost updates.
var configMu sync.Mutex

// ConfigPath stores the path to the config file for saving
var ConfigPath string

type Config struct {
	DataDir        string `toml:"data_dir"` // session store directory, default ~/.cc-connect

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Remove run_as_user from config.toml on Windows hosts
  2. Run cc-connect under the desired user account directly
  3. Deploy on Linux/macOS if privilege separation is required
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at config/config.go:69 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/bbe1f21f5639027c. Report an issue: GitHub.