chenhg5/cc-connect · error

wps-agentspace: auto-login failed: %w

Error message

wps-agentspace: auto-login failed: %w

What it means

During platform construction, no wps_sid was available from config or environment, and the autoLogin attempt with the configured app_id also failed — so the platform cannot authenticate to WPS Agentspace at all.

Source

Thrown at platform/wps-agentspace/wpsagentspace.go:126

func init() {
	core.RegisterPlatform("wps-agentspace", New)
}

// New creates a new Platform instance.
func New(opts map[string]any) (core.Platform, error) {
	appID, _ := opts["app_id"].(string)
	wpsSid, _ := opts["wps_sid"].(string)

	// Try to get wps_sid from environment variable
	if wpsSid == "" {
		wpsSid = getEnvWithPrefix("WPS_SID", "")
	}

	// If wps_sid is empty, try auto-login
	if wpsSid == "" {
		sid, encrypted, err := autoLogin(appID)
		if err != nil {
			return nil, fmt.Errorf("wps-agentspace: auto-login failed: %w", err)
		}
		wpsSid = sid

		// Auto-save to config file
		if encrypted != "" {
			saved := saveToConfig(appID, encrypted)
			if saved {
				fmt.Println("\n✓ Token 已自动保存到配置文件")
			} else {
				fmt.Println("\n=========================================")
				fmt.Println("  Token 已获取,请设置环境变量:")
				fmt.Println("=========================================")
				fmt.Printf("\n  export WPS_SID='%s'\n\n", encrypted)
				fmt.Println("  或添加到 ~/.zshrc / ~/.bashrc")
				fmt.Println("=========================================")
			}
		}
	}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Provide a valid wps_sid explicitly in config or via the WPS_SID environment variable
  2. Verify the app_id used for autoLogin is correct and the login endpoint is reachable
  3. Treat as fatal startup misconfiguration: fail fast and surface the wrapped autoLogin error
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at platform/wps-agentspace/wpsagentspace.go:126 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/ad16ae5c813e4883. Report an issue: GitHub.