{"record":{"id":"cf594cfd13e53545","repo":"sipeed/picoclaw","slug":"feishu-edit-w","errorCode":null,"errorMessage":"feishu edit: %w","messagePattern":"feishu edit: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/channels/feishu/feishu_64.go","lineNumber":259,"sourceCode":"\treturn nil, err\n}\n\n// EditMessage implements channels.MessageEditor.\n// Uses Message.Patch to update an interactive card message.\nfunc (c *FeishuChannel) EditMessage(ctx context.Context, chatID, messageID, content string) error {\n\tcardContent, err := buildMarkdownCard(content)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"feishu edit: card build failed: %w\", err)\n\t}\n\n\treq := larkim.NewPatchMessageReqBuilder().\n\t\tMessageId(messageID).\n\t\tBody(larkim.NewPatchMessageReqBodyBuilder().Content(cardContent).Build()).\n\t\tBuild()\n\n\tresp, err := c.client.Im.V1.Message.Patch(ctx, req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"feishu edit: %w\", err)\n\t}\n\tif !resp.Success() {\n\t\tc.invalidateTokenOnAuthError(resp.Code)\n\t\treturn fmt.Errorf(\"feishu edit api error (code=%d msg=%s)\", resp.Code, resp.Msg)\n\t}\n\treturn nil\n}\n\n// DeleteMessage implements channels.MessageDeleter.\nfunc (c *FeishuChannel) DeleteMessage(ctx context.Context, chatID, messageID string) error {\n\tdeleteFn := c.deleteMessageFn\n\tif deleteFn == nil {\n\t\tdeleteFn = c.deleteMessageAPI\n\t}\n\treturn deleteFn(ctx, chatID, messageID)\n}\n\nfunc (c *FeishuChannel) deleteMessageAPI(ctx context.Context, chatID, messageID string) error {","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/channels/feishu/feishu_64.go#L241-L277","documentation":"FeishuChannel.EditMessage called lark SDK Im.V1.Message.Patch and the SDK itself returned a transport-level error (request could not be completed or returned a non-parsable response). The SDK error is wrapped with the 'feishu edit:' prefix; no Feishu business code is available because the response never parsed.","triggerScenarios":"PATCH /open-apis/im/v1/messages/:message_id fails at the network layer: timeout, connection reset, DNS failure, or an HTTP response the lark SDK could not decode.","commonSituations":"Transient network issues between the host and open.feishu.cn; corporate proxy interference; oversized card payload causing slow upload and client timeout; Feishu API briefly unavailable.","solutions":["Retry the edit with short backoff - transport errors are usually transient","If persistent, reproduce with curl against open.feishu.cn to isolate network vs code","Check the card content size; very large patches can exceed intermediary timeouts","Verify client timeout settings on the lark client options"],"exampleFix":"// before\nreturn ch.EditMessage(ctx, chatID, msgID, content)\n\n// after\nvar err error\nfor i := 0; i < 3; i++ {\n\tif err = ch.EditMessage(ctx, chatID, msgID, content); err == nil {\n\t\treturn nil\n\t}\n\tif strings.Contains(err.Error(), \"feishu edit api error\") {\n\t\tbreak // business error: do not blind-retry\n\t}\n\ttime.Sleep(time.Duration(i+1) * 500 * time.Millisecond)\n}\nreturn err","handlingStrategy":"retry","validationCode":"null","typeGuard":"func isEditTransportError(err error) bool {\n\treturn err != nil && strings.HasPrefix(err.Error(), \"feishu edit: \") && !strings.Contains(err.Error(), \"feishu edit api error\")\n}","tryCatchPattern":"err := ch.EditMessage(ctx, chatID, msgID, content)\nfor i := 0; isEditTransportError(err) && i < 3; i++ {\n\ttime.Sleep(time.Duration(i+1) * 500 * time.Millisecond)\n\terr = ch.EditMessage(ctx, chatID, msgID, content)\n}\nreturn err","preventionTips":["Distinguish transport ('feishu edit: %w') from business ('feishu edit api error') before retrying","Set generous-but-finite SDK timeouts for large card patches","Keep card payloads compact to avoid slow-upload timeouts","Add jitter to retries when many edits follow a streaming completion"],"tags":["feishu","network","edit","lark-sdk","transport"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}