chenhg5/cc-connect · error

cloud_web: register rejected: %s

Error message

cloud_web: register rejected: %s

What it means

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.

Source

Thrown at platform/cloud-web/protocol.go:204

		Project:   project,
		Transport: transport,
		Metadata: map[string]any{
			"protocol_version": protocolVersion,
		},
	}
}

func parseRegisterAck(raw []byte) (map[string]bool, error) {
	var ack wireRegisterAck
	if err := json.Unmarshal(raw, &ack); err != nil {
		return nil, fmt.Errorf("cloud_web: parse register_ack: %w", err)
	}
	if ack.Type != "register_ack" {
		return nil, fmt.Errorf("cloud_web: expected register_ack, got %q", ack.Type)
	}
	if !ack.OK {
		if ack.Error != "" {
			return nil, fmt.Errorf("cloud_web: register rejected: %s", ack.Error)
		}
		return nil, fmt.Errorf("cloud_web: register rejected")
	}
	if len(ack.Capabilities) == 0 {
		return defaultCapabilities(), nil
	}
	return capabilitySet(ack.Capabilities), nil
}

func decodeImages(items []wireImage) []core.ImageAttachment {
	var out []core.ImageAttachment
	for _, img := range items {
		data, err := base64.StdEncoding.DecodeString(img.Data)
		if err != nil {
			slog.Debug("cloud_web: invalid image base64", "error", err)
			continue
		}
		out = append(out, core.ImageAttachment{

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Read the %s suffix in the error — it contains the server's rejection reason — and fix that specific cause
  2. Refresh the auth token configured for the cloud-web platform (config.toml token field)
  3. Ensure only one instance registers with the same agent identifier; stop the duplicate process
  4. Check server-side logs/allowlist for why this client id or token was refused

Example fix

// before (config with stale token)
[platforms.cloud-web]
token = "old-expired-token"
// after
[platforms.cloud-web]
token = "freshly-issued-token"
Defensive patterns

Strategy: validation

Validate before calling

// Sanity-check token before starting the transport
if strings.TrimSpace(cfg.Token) == "" || cfg.Token == staleToken {
    return fmt.Errorf("cloud-web token missing or stale; refresh before connect")
}

Try / catch

// Surface the server-provided reason and stop retrying immediately (auth errors rarely self-heal)
if err := register(ctx); err != nil {
    if strings.Contains(err.Error(), "register rejected:") {
        slog.Error("cloud-web refused registration", "reason", err)
        return err // do not hot-retry with bad credentials
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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