{"record":{"id":"ff200c2964c909cb","repo":"chenhg5/cc-connect","slug":"wps-agentspace-fatal-error-s","errorCode":null,"errorMessage":"wps-agentspace: fatal error: %s","messagePattern":"wps-agentspace: fatal error: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/wps-agentspace/wpsagentspace.go","lineNumber":515,"sourceCode":"\t\tif err := json.Unmarshal(frame.Data, &data); err == nil && data.DeviceUUID != \"\" {\n\t\t\tp.deviceUuid = data.DeviceUUID\n\t\t\tslog.Info(\"wps-agentspace: init ok\", \"device_uuid\", data.DeviceUUID)\n\t\t}\n\t\treturn nil\n\n\tcase \"error\":\n\t\tvar data errorData\n\t\tif err := json.Unmarshal(frame.Data, &data); err == nil {\n\t\t\tfatalCodes := []string{\n\t\t\t\t\"USER_NO_APP_PERMISSION\",\n\t\t\t\t\"USER_NO_OPENCLAW_PERMISSION\",\n\t\t\t\t\"OPENCLAW_NOT_CONFIGURED\",\n\t\t\t\t\"NOT_OPENCLAW_APP\",\n\t\t\t\t\"NOT_LOGIN\",\n\t\t\t}\n\t\t\tfor _, code := range fatalCodes {\n\t\t\t\tif data.Code == code {\n\t\t\t\t\treturn fmt.Errorf(\"wps-agentspace: fatal error: %s\", data.Code)\n\t\t\t\t}\n\t\t\t}\n\t\t\tslog.Warn(\"wps-agentspace: server error\", \"code\", data.Code)\n\t\t}\n\t\treturn nil\n\n\tcase \"message\":\n\t\tvar data messageData\n\t\tif err := json.Unmarshal(frame.Data, &data); err != nil {\n\t\t\treturn fmt.Errorf(\"wps-agentspace: parse message: %w\", err)\n\t\t}\n\t\tslog.Debug(\"wps-agentspace: message frame\", \"role\", data.Role, \"type\", data.Type, \"content_len\", len(data.Content))\n\t\tif data.Role == \"user\" {\n\t\t\treturn p.handleUserMessage(data)\n\t\t}\n\t\treturn nil\n\n\tdefault:","sourceCodeStart":497,"sourceCodeEnd":533,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/wps-agentspace/wpsagentspace.go#L497-L533","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Fix the code named in the message: for NOT_LOGIN, refresh the WPS login/cookie (wps_sid) and restart","For OPENCLAW_NOT_CONFIGURED / NOT_OPENCLAW_APP, install/enable the OpenClaw agent app in the WPS AgentSpace workspace","For USER_NO_APP_PERMISSION / USER_NO_OPENCLAW_PERMISSION, have a workspace admin grant the account agent permissions","After fixing, restart cc-connect so connectLoop re-establishes with valid credentials"],"exampleFix":"// server-side remediation, not a code fix:\n// before\n// wsURL = wss://agentspace.wps.cn/v7/devhub/ws/<appID>/chat  (appID of a workspace without the agent)\n// after\n// config.toml: set the correct app_id for a workspace with OpenClaw enabled and a valid wps_sid","handlingStrategy":"validation","validationCode":"// check configuration/login posture before relying on the connection\nfatal := map[string]string{\n\t\"NOT_LOGIN\":                   \"refresh wps_sid credentials\",\n\t\"OPENCLAW_NOT_CONFIGURED\":     \"enable OpenClaw app in workspace\",\n\t\"NOT_OPENCLAW_APP\":            \"install the agent app\",\n\t\"USER_NO_APP_PERMISSION\":      \"grant user app permission\",\n\t\"USER_NO_OPENCLAW_PERMISSION\": \"grant user agent permission\",\n}\nif hint, ok := fatal[errCode]; ok {\n\tlog.Printf(\"fatal: %s — %s\", errCode, hint)\n}","typeGuard":null,"tryCatchPattern":"if err := p.readLoop(conn, ctx); err != nil {\n\tif strings.Contains(err.Error(), \"fatal error: NOT_LOGIN\") {\n\t\t// stop retrying; require re-auth instead of hammering the server\n\t\tp.Stop()\n\t}\n}","preventionTips":["Keep WPS credentials (wps_sid) fresh; rotate before expiry","Confirm the workspace has the OpenClaw/agent app installed before deploying","Verify account permissions with the workspace admin during setup","Treat these codes as stop conditions — do not blindly reconnect"],"tags":["auth","permissions","websocket"],"backgroundTag":"auth-permission-denied","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"}