chenhg5/cc-connect · error

%s: %s

Error message

%s: %s

What it means

When the registration "init" call succeeds but the response carries an Error field, runRegistrationFlow returns `<Error>: <ErrorDescription>`, surfacing the remote service's own error name and description directly to the user.

Source

Thrown at cmd/cc-connect/feishu.go:549

	return false, nil
}

func runRegistrationFlow(opts registrationFlowOptions) (*registrationFlowResult, error) {
	if opts.TimeoutSeconds <= 0 {
		opts.TimeoutSeconds = 600
	}
	client := &registrationClient{
		baseURL: accountsFeishuBaseURL,
		http:    &http.Client{Timeout: 15 * time.Second},
		debug:   opts.Debug,
	}

	var initRes registrationInitResponse
	if err := client.registrationCall("init", nil, &initRes); err != nil {
		return nil, fmt.Errorf("init failed: %w", err)
	}
	if initRes.Error != "" {
		return nil, fmt.Errorf("%s: %s", initRes.Error, initRes.ErrorDescription)
	}
	if len(initRes.SupportedAuthMethods) > 0 && !containsString(initRes.SupportedAuthMethods, "client_secret") {
		return nil, fmt.Errorf("current environment does not support client_secret auth")
	}

	var beginRes registrationBeginResponse
	beginParams := map[string]string{
		"archetype":         "PersonalAgent",
		"auth_method":       "client_secret",
		"request_user_info": "open_id",
	}
	if err := client.registrationCall("begin", beginParams, &beginRes); err != nil {
		return nil, fmt.Errorf("begin failed: %w", err)
	}
	if beginRes.Error != "" {
		return nil, fmt.Errorf("%s: %s", beginRes.Error, beginRes.ErrorDescription)
	}
	if beginRes.DeviceCode == "" || beginRes.VerificationURIComplete == "" {

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Read <Error> and <ErrorDescription> from the message and address what the service reports (e.g. invalid parameter, forbidden).
  2. Retry later if the description indicates a temporary/service-side condition or rate limit.
  3. Update cc-connect to the latest version in case the request format changed.
  4. If the environment is unsupported, use the manual setup path (editing config.toml directly) instead of the registration flow.
Defensive patterns

Strategy: try-catch

Try / catch

if err := runFeishuSetup(...); err != nil {
    var svcErr *RegistrationServiceError // or match "<name>: <desc>" shape
    if errors.As(err, &svcErr) {
        log.Printf("registration service rejected init: %s - %s", svcErr.Name, svcErr.Description)
    }
}

Prevention

When it happens

Trigger: The registration service rejects the init request — e.g. invalid request parameters, disallowed origin/environment, service-side validation failure, or rate limiting — returning {error, error_description} in the init response body.

Common situations: Registration service temporarily rejecting requests; environment restrictions (the follow-up check also rejects environments without client_secret support); malformed request built by an outdated cc-connect version.

Related errors


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