chenhg5/cc-connect · error

%s: update card entity: %w

Error message

%s: update card entity: %w

What it means

updateCardEntity wraps the cardkit v1 PUT (/open-apis/cardkit/v1/cards/{card_id}) transport failure inside the fresh-token retry layer; the full-card replacement for rich-mode (card_id reference) messages failed.

Source

Thrown at platform/feishu/feishu.go:5383

	cardID := h.cardID
	seq := h.sequence
	h.mu.Unlock()

	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 {

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Check card_id validity and cardkit permissions
  2. Retry on transient errors (token retry is built in)
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at platform/feishu/feishu.go:5383 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/ea5078686d0fcfbc. Report an issue: GitHub.