{"record":{"id":"2f7e7f78deff1feb","repo":"sipeed/picoclaw","slug":"feishu-delete-w","errorCode":null,"errorMessage":"feishu delete: %w","messagePattern":"feishu delete: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/channels/feishu/feishu_64.go","lineNumber":284,"sourceCode":"}\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 {\n\treq := larkim.NewDeleteMessageReqBuilder().\n\t\tMessageId(messageID).\n\t\tBuild()\n\n\tresp, err := c.client.Im.V1.Message.Delete(ctx, req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"feishu delete: %w\", err)\n\t}\n\tif !resp.Success() {\n\t\tc.invalidateTokenOnAuthError(resp.Code)\n\t\treturn fmt.Errorf(\"feishu delete api error (code=%d msg=%s)\", resp.Code, resp.Msg)\n\t}\n\treturn nil\n}\n\n// SendPlaceholder implements channels.PlaceholderCapable.\n// Sends an interactive card with placeholder text and returns its message ID.\nfunc (c *FeishuChannel) SendPlaceholder(ctx context.Context, chatID string) (string, error) {\n\tif !c.bc.Placeholder.Enabled {\n\t\tlogger.DebugCF(\"feishu\", \"Placeholder disabled, skipping\", map[string]any{\n\t\t\t\"chat_id\": chatID,\n\t\t})\n\t\treturn \"\", nil\n\t}\n","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/channels/feishu/feishu_64.go#L266-L302","documentation":"FeishuChannel.deleteMessageAPI called lark SDK Im.V1.Message.Delete and the SDK returned a transport-level error before a business response could be parsed. The SDK error is wrapped with the 'feishu delete:' prefix; there is no Feishu code to inspect.","triggerScenarios":"DELETE /open-apis/im/v1/messages/:message_id fails at the network layer: timeout, connection refused/reset, DNS failure, or an unparseable HTTP response.","commonSituations":"Transient connectivity loss when cleaning up placeholder messages; proxy/TLS issues in the deployment network; Feishu edge briefly unavailable; deletion burst hitting socket limits.","solutions":["Retry the delete with backoff - placeholders cleanup is time-tolerant","If retries keep failing, check connectivity to open.feishu.cn and proxy config","Treat leftover undeleted placeholders as cosmetic: log and move on rather than blocking the pipeline"],"exampleFix":"// before\n_ = ch.DeleteMessage(ctx, chatID, msgID) // one-shot, silent loss\n\n// after\nvar err error\nfor i := 0; i < 3; i++ {\n\tif err = ch.DeleteMessage(ctx, chatID, msgID); err == nil {\n\t\tbreak\n\t}\n\ttime.Sleep(time.Duration(i+1) * 300 * time.Millisecond)\n}\nif err != nil {\n\tlogger.Warn(\"placeholder cleanup failed\", \"msg_id\", msgID, \"err\", err)\n}","handlingStrategy":"retry","validationCode":"null","typeGuard":"func isDeleteTransportError(err error) bool {\n\treturn err != nil && strings.HasPrefix(err.Error(), \"feishu delete: \") && !strings.Contains(err.Error(), \"feishu delete api error\")\n}","tryCatchPattern":"err := ch.DeleteMessage(ctx, chatID, msgID)\nfor i := 0; isDeleteTransportError(err) && i < 3; i++ {\n\ttime.Sleep(time.Duration(i+1) * 300 * time.Millisecond)\n\terr = ch.DeleteMessage(ctx, chatID, msgID)\n}\nif err != nil { logger.Warn(\"placeholder cleanup failed\", \"msg_id\", msgID, \"err\", err) }","preventionTips":["Treat placeholder cleanup as best-effort; never block the reply pipeline on it","Retry only transport-class deletes, never business-code deletes","Deduplicate delete calls after retries to avoid double-delete","Monitor delete failures in aggregate - spikes indicate network issues"],"tags":["feishu","network","delete","lark-sdk","transport"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}