chenhg5/cc-connect · error

%s: update card entity: HTTP status %d

Error message

%s: update card entity: HTTP status %d

What it means

updateCardEntity's PUT to the CardKit /cards/{card_id} endpoint returned a non-HTTP-200 status. Indicates the card entity update (used for typewriter streaming) failed server-side or the card_id is invalid.

Source

Thrown at platform/feishu/feishu.go:5386

	apiPath := fmt.Sprintf("/open-apis/cardkit/v1/cards/%s", cardID)
	body := map[string]any{
		"card": map[string]any{
			"type": "card_json",
			"data": cardJSON,
		},
		"sequence": seq,
	}
	var apiResp *larkcore.ApiResp
	if err := p.withFreshTenantAccessTokenRetry(ctx, "update card entity", func(client *lark.Client, options ...larkcore.RequestOptionFunc) error {
		var err error
		apiResp, err = client.Put(ctx, apiPath, body, larkcore.AccessTokenTypeTenant, options...)
		return err
	}); err != nil {
		return fmt.Errorf("%s: update card entity: %w", p.tag(), err)
	}
	if apiResp == nil || apiResp.StatusCode != http.StatusOK {
		return fmt.Errorf("%s: update card entity: HTTP status %d", p.tag(), apiResp.StatusCode)
	}
	var resp struct {
		Code int    `json:"code"`
		Msg  string `json:"msg"`
	}
	if err := json.Unmarshal(apiResp.RawBody, &resp); err != nil {
		return fmt.Errorf("%s: update card entity: parse response: %w", p.tag(), err)
	}
	if resp.Code != 0 {
		return fmt.Errorf("%s: %w", p.tag(), classifyFeishuCardAPIError("update card entity", resp.Code, resp.Msg))
	}
	return nil
}

func (p *Platform) Stop() error {
	// Issue #1618: stop the background supervisor that retries the
	// bot-info API when startup discovery fails. Without this the
	// goroutine could outlive the platform and leak into the next

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Check status: 404 card deleted, 429 throttled — back off accordingly
  2. Fall back to Im.Message.Patch if cardkit remains unavailable
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at platform/feishu/feishu.go:5386 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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