{"record":{"id":"5c017c9714e20973","repo":"chenhg5/cc-connect","slug":"s-updatecardentity-cardid-not-set","errorCode":null,"errorMessage":"%s: updateCardEntity: cardID not set","messagePattern":"(.+?): updateCardEntity: cardID not set","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/feishu/feishu.go","lineNumber":5362,"sourceCode":"\t\t\t\treturn fmt.Errorf(\"%s: patch message code=%d msg=%s\", p.tag(), resp.Code, resp.Msg)\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t})\n}\n\n// updateCardEntity performs a full-card replacement on a cardkit-v1 entity via\n// PUT /open-apis/cardkit/v1/cards/{card_id}. Required for messages that were\n// sent as card_id references (rich-mode path) — Im.Message.Patch does not\n// affect the rendered content of such messages.\n//\n// Reuses h.sequence as the monotonic ordering counter (shared with\n// streamRichCardText so any sequence on any element/card is monotonic).\nfunc (p *Platform) updateCardEntity(ctx context.Context, h *feishuPreviewHandle, cardJSON string) error {\n\th.mu.Lock()\n\tif h.cardID == \"\" {\n\t\th.mu.Unlock()\n\t\treturn fmt.Errorf(\"%s: updateCardEntity: cardID not set\", p.tag())\n\t}\n\th.sequence++\n\tcardID := h.cardID\n\tseq := h.sequence\n\th.mu.Unlock()\n\n\tapiPath := fmt.Sprintf(\"/open-apis/cardkit/v1/cards/%s\", cardID)\n\tbody := map[string]any{\n\t\t\"card\": map[string]any{\n\t\t\t\"type\": \"card_json\",\n\t\t\t\"data\": cardJSON,\n\t\t},\n\t\t\"sequence\": seq,\n\t}\n\tvar apiResp *larkcore.ApiResp\n\tif err := p.withFreshTenantAccessTokenRetry(ctx, \"update card entity\", func(client *lark.Client, options ...larkcore.RequestOptionFunc) error {\n\t\tvar err error\n\t\tapiResp, err = client.Put(ctx, apiPath, body, larkcore.AccessTokenTypeTenant, options...)","sourceCodeStart":5344,"sourceCodeEnd":5380,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/feishu/feishu.go#L5344-L5380","documentation":"updateCardEntity precondition guard: the preview handle's cardID is empty, meaning the message was sent as inline card JSON (not a card_id reference), so the cardkit entity PUT does not apply — Im.Message.Patch must be used instead.","triggerScenarios":"Thrown at platform/feishu/feishu.go:5362 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call patchCardMessage for inline-card messages","Only call updateCardEntity when the handle carries a cardID"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}