{"record":{"id":"f4c469025c26d9f3","repo":"chenhg5/cc-connect","slug":"s-reply-api-call-w","errorCode":null,"errorMessage":"%s: reply api call: %w","messagePattern":"(.+?): reply api call: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/feishu/feishu.go","lineNumber":4055,"sourceCode":"\tbody := larkim.NewReplyMessageReqBodyBuilder().\n\t\tMsgType(msgType).\n\t\tContent(content)\n\tif p.shouldReplyInThread(rc) {\n\t\tbody.ReplyInThread(true)\n\t}\n\treturn body.Build()\n}\n\nfunc (p *Platform) replyMessage(ctx context.Context, rc replyContext, msgType, content string) error {\n\treq := larkim.NewReplyMessageReqBuilder().\n\t\tMessageId(rc.messageID).\n\t\tBody(p.buildReplyMessageReqBody(rc, msgType, content)).\n\t\tBuild()\n\treturn p.withTransientRetry(ctx, \"reply\", func() error {\n\t\treturn p.withFreshTenantAccessTokenRetry(ctx, \"reply\", func(client *lark.Client, options ...larkcore.RequestOptionFunc) error {\n\t\t\tresp, err := client.Im.Message.Reply(ctx, req, options...)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"%s: reply api call: %w\", p.tag(), err)\n\t\t\t}\n\t\t\tif !resp.Success() {\n\t\t\t\treturn fmt.Errorf(\"%s: reply failed 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\nfunc (p *Platform) createMessage(ctx context.Context, chatID, msgType, content, op string) error {\n\treq := larkim.NewCreateMessageReqBuilder().\n\t\tReceiveIdType(larkim.ReceiveIdTypeChatId).\n\t\tBody(larkim.NewCreateMessageReqBodyBuilder().\n\t\t\tReceiveId(chatID).\n\t\t\tMsgType(msgType).\n\t\t\tContent(content).\n\t\t\tBuild()).\n\t\tBuild()","sourceCodeStart":4037,"sourceCodeEnd":4073,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/feishu/feishu.go#L4037-L4073","documentation":"Wraps a transport-level failure from the Lark SDK's Im.Message.Reply call — the request never completed successfully (network error, timeout, DNS failure, or SDK-level error). Both retry layers (transient retry and fresh-token retry) have already been applied; this error escapes only if retries were exhausted or the error is non-retryable.","triggerScenarios":"client.Im.Message.Reply returns a non-nil error: network partition, TLS failure, request timeout, or SDK client construction/serialization problem while replying to a message in a Feishu chat.","commonSituations":"Feishu/Lark API outage, container DNS misconfiguration, proxy/firewall blocking open.feishu.cn or open.larksuite.com, or very large message content causing timeouts.","solutions":["Inspect the wrapped error (%w) for the root cause — connection vs timeout vs TLS.","Check outbound network connectivity to the Feishu API domain from the host running cc-connect.","If timeouts, review withTransientRetry settings or reduce message payload size.","Verify no stale lark client is being reused; the fresh-token retry wrapper should handle auth-side failures."],"exampleFix":"// before\nreturn fmt.Errorf(\"%s: reply api call: %w\", p.tag(), err)\n// after\nreturn fmt.Errorf(\"%s: reply api call: %w\", p.tag(), err) // caller should inspect errors.Unwrap for retry/network classification","handlingStrategy":"retry","validationCode":"if err := checkConnectivity(\"open.feishu.cn:443\"); err != nil { /* defer sends */ }","typeGuard":null,"tryCatchPattern":"err := p.replyMessage(ctx, rc, msgType, content)\nif err != nil && isNetworkError(err) {\n\t// queue for retry with exponential backoff\n}","preventionTips":["Rely on the built-in withTransientRetry wrapper and tune its budget.","Monitor egress connectivity to Feishu domains.","Avoid oversized message payloads.","Pin DNS resolution in containers to avoid resolution flakes."],"tags":["feishu","lark","network","api-call","reply"],"backgroundTag":"api-request-failed","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"}