{"record":{"id":"d7aefc503f2254dc","repo":"chenhg5/cc-connect","slug":"cloud-web-register-rejected-s","errorCode":null,"errorMessage":"cloud_web: register rejected: %s","messagePattern":"cloud_web: register rejected: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/cloud-web/protocol.go","lineNumber":204,"sourceCode":"\t\tProject:   project,\n\t\tTransport: transport,\n\t\tMetadata: map[string]any{\n\t\t\t\"protocol_version\": protocolVersion,\n\t\t},\n\t}\n}\n\nfunc parseRegisterAck(raw []byte) (map[string]bool, error) {\n\tvar ack wireRegisterAck\n\tif err := json.Unmarshal(raw, &ack); err != nil {\n\t\treturn nil, fmt.Errorf(\"cloud_web: parse register_ack: %w\", err)\n\t}\n\tif ack.Type != \"register_ack\" {\n\t\treturn nil, fmt.Errorf(\"cloud_web: expected register_ack, got %q\", ack.Type)\n\t}\n\tif !ack.OK {\n\t\tif ack.Error != \"\" {\n\t\t\treturn nil, fmt.Errorf(\"cloud_web: register rejected: %s\", ack.Error)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"cloud_web: register rejected\")\n\t}\n\tif len(ack.Capabilities) == 0 {\n\t\treturn defaultCapabilities(), nil\n\t}\n\treturn capabilitySet(ack.Capabilities), nil\n}\n\nfunc decodeImages(items []wireImage) []core.ImageAttachment {\n\tvar out []core.ImageAttachment\n\tfor _, img := range items {\n\t\tdata, err := base64.StdEncoding.DecodeString(img.Data)\n\t\tif err != nil {\n\t\t\tslog.Debug(\"cloud_web: invalid image base64\", \"error\", err)\n\t\t\tcontinue\n\t\t}\n\t\tout = append(out, core.ImageAttachment{","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/cloud-web/protocol.go#L186-L222","documentation":"When the register_ack frame parses and has the correct type but ack.OK is false with a non-empty Error field, parseRegisterAck returns this error carrying the server's rejection reason. The cloud-web hub explicitly refused this client's registration (the ack contains ok=false plus a human-readable error string). The remote reason text is embedded after the prefix.","triggerScenarios":"Server responds with {\"type\":\"register_ack\",\"ok\":false,\"error\":\"<reason>\"} — e.g. invalid/expired token, duplicate registration, unknown agent id, or capability validation failure at the hub.","commonSituations":"Stale or wrong auth token in config (token query param rejected by server); registering the same agent/session id twice from two instances; server-side allowlist or quota rejecting the client; server restarted with different credentials/secret.","solutions":["Read the %s suffix in the error — it contains the server's rejection reason — and fix that specific cause","Refresh the auth token configured for the cloud-web platform (config.toml token field)","Ensure only one instance registers with the same agent identifier; stop the duplicate process","Check server-side logs/allowlist for why this client id or token was refused"],"exampleFix":"// before (config with stale token)\n[platforms.cloud-web]\ntoken = \"old-expired-token\"\n// after\n[platforms.cloud-web]\ntoken = \"freshly-issued-token\"","handlingStrategy":"validation","validationCode":"// Sanity-check token before starting the transport\nif strings.TrimSpace(cfg.Token) == \"\" || cfg.Token == staleToken {\n    return fmt.Errorf(\"cloud-web token missing or stale; refresh before connect\")\n}","typeGuard":null,"tryCatchPattern":"// Surface the server-provided reason and stop retrying immediately (auth errors rarely self-heal)\nif err := register(ctx); err != nil {\n    if strings.Contains(err.Error(), \"register rejected:\") {\n        slog.Error(\"cloud-web refused registration\", \"reason\", err)\n        return err // do not hot-retry with bad credentials\n    }\n}","preventionTips":["Rotate and verify tokens out-of-band before deploying configs","Ensure only one instance uses a given agent identity","Check the hub's allowlist/quota when onboarding new clients","Read the error suffix — it contains the server's reason"],"tags":["websocket","authentication","registration","cloud-web"],"backgroundTag":"api-error-response","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}