chenhg5/cc-connect · error

wps-agentspace: fatal error: %s

Error message

wps-agentspace: fatal error: %s

What it means

When the server sends an "error" frame whose code is one of the fatal codes (USER_NO_APP_PERMISSION, USER_NO_OPENCLAW_PERMISSION, OPENCLAW_NOT_CONFIGURED, NOT_OPENCLAW_APP, NOT_LOGIN), handleFrame returns "wps-agentspace: fatal error: %s". These codes mean the account/device cannot use the agent at all, so retrying is pointless until configuration or login is fixed. Non-fatal codes are only logged as warnings.

Source

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

		if err := json.Unmarshal(frame.Data, &data); err == nil && data.DeviceUUID != "" {
			p.deviceUuid = data.DeviceUUID
			slog.Info("wps-agentspace: init ok", "device_uuid", data.DeviceUUID)
		}
		return nil

	case "error":
		var data errorData
		if err := json.Unmarshal(frame.Data, &data); err == nil {
			fatalCodes := []string{
				"USER_NO_APP_PERMISSION",
				"USER_NO_OPENCLAW_PERMISSION",
				"OPENCLAW_NOT_CONFIGURED",
				"NOT_OPENCLAW_APP",
				"NOT_LOGIN",
			}
			for _, code := range fatalCodes {
				if data.Code == code {
					return fmt.Errorf("wps-agentspace: fatal error: %s", data.Code)
				}
			}
			slog.Warn("wps-agentspace: server error", "code", data.Code)
		}
		return nil

	case "message":
		var data messageData
		if err := json.Unmarshal(frame.Data, &data); err != nil {
			return fmt.Errorf("wps-agentspace: parse message: %w", err)
		}
		slog.Debug("wps-agentspace: message frame", "role", data.Role, "type", data.Type, "content_len", len(data.Content))
		if data.Role == "user" {
			return p.handleUserMessage(data)
		}
		return nil

	default:

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Fix the code named in the message: for NOT_LOGIN, refresh the WPS login/cookie (wps_sid) and restart
  2. For OPENCLAW_NOT_CONFIGURED / NOT_OPENCLAW_APP, install/enable the OpenClaw agent app in the WPS AgentSpace workspace
  3. For USER_NO_APP_PERMISSION / USER_NO_OPENCLAW_PERMISSION, have a workspace admin grant the account agent permissions
  4. After fixing, restart cc-connect so connectLoop re-establishes with valid credentials

Example fix

// server-side remediation, not a code fix:
// before
// wsURL = wss://agentspace.wps.cn/v7/devhub/ws/<appID>/chat  (appID of a workspace without the agent)
// after
// config.toml: set the correct app_id for a workspace with OpenClaw enabled and a valid wps_sid
Defensive patterns

Strategy: validation

Validate before calling

// check configuration/login posture before relying on the connection
fatal := map[string]string{
	"NOT_LOGIN":                   "refresh wps_sid credentials",
	"OPENCLAW_NOT_CONFIGURED":     "enable OpenClaw app in workspace",
	"NOT_OPENCLAW_APP":            "install the agent app",
	"USER_NO_APP_PERMISSION":      "grant user app permission",
	"USER_NO_OPENCLAW_PERMISSION": "grant user agent permission",
}
if hint, ok := fatal[errCode]; ok {
	log.Printf("fatal: %s — %s", errCode, hint)
}

Try / catch

if err := p.readLoop(conn, ctx); err != nil {
	if strings.Contains(err.Error(), "fatal error: NOT_LOGIN") {
		// stop retrying; require re-auth instead of hammering the server
		p.Stop()
	}
}

Prevention

When it happens

Trigger: Server pushes event="error" with data.code equal to one of the five fatal strings — typically NOT_LOGIN after session/cookie expiry, OPENCLAW_NOT_CONFIGURED/NOT_OPENCLAW_APP when the WPS workspace lacks the OpenClaw agent app, or USER_NO_*_PERMISSION when the user's account lacks access.

Common situations: Expired WPS login (wps_sid cookie expired); the AgentSpace app was removed or never installed in the workspace; a user without agent permission attempts to connect; environment misconfigured against a workspace that has not enabled OpenClaw.

Related errors


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