{"record":{"id":"29e681b1c88d1c43","repo":"chenhg5/cc-connect","slug":"s-patch-message-w","errorCode":null,"errorMessage":"%s: patch message: %w","messagePattern":"(.+?): patch message: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/feishu/feishu.go","lineNumber":5341,"sourceCode":"\th.mu.Unlock()\n\tif cardID != \"\" {\n\t\treturn p.updateCardEntity(ctx, h, cardJSON)\n\t}\n\treturn p.patchCardMessage(ctx, h.messageID, cardJSON)\n}\n\nfunc (p *Platform) patchCardMessage(ctx context.Context, messageID, cardJSON string) error {\n\treq := larkim.NewPatchMessageReqBuilder().\n\t\tMessageId(messageID).\n\t\tBody(larkim.NewPatchMessageReqBodyBuilder().\n\t\t\tContent(cardJSON).\n\t\t\tBuild()).\n\t\tBuild()\n\treturn p.withTransientRetry(ctx, \"patch message\", func() error {\n\t\treturn p.withFreshTenantAccessTokenRetry(ctx, \"patch message\", func(client *lark.Client, options ...larkcore.RequestOptionFunc) error {\n\t\t\tresp, err := client.Im.Message.Patch(ctx, req, options...)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"%s: patch message: %w\", p.tag(), err)\n\t\t\t}\n\t\t\tif !resp.Success() {\n\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()","sourceCodeStart":5323,"sourceCodeEnd":5359,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/feishu/feishu.go#L5323-L5359","documentation":"Wrapped failure from patching an existing Feishu card message (larkim PatchMessage) with new card JSON, where %s is the retry operation label; fires when the patch API call fails after transient-retry and fresh-tenant-access-token retry wrappers.","triggerScenarios":"Thrown at platform/feishu/feishu.go:5341 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rely on retries; check the message still exists (not recalled)"],"exampleFix":null,"handlingStrategy":"retry","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"}