{"record":{"id":"a8e009d20d2bf426","repo":"chenhg5/cc-connect","slug":"s-build-image-message-w","errorCode":null,"errorMessage":"%s: build image message: %w","messagePattern":"(.+?): build image message: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/feishu/feishu.go","lineNumber":3275,"sourceCode":"\tif p.shouldUseThreadOrReplyAPI(rc) {\n\t\treturn p.replyMessage(ctx, rc, larkim.MsgTypeInteractive, cardJSON)\n\t}\n\treturn p.sendNewMessageToChat(ctx, rc, larkim.MsgTypeInteractive, cardJSON)\n}\n\nfunc (p *Platform) SendImage(ctx context.Context, rctx any, img core.ImageAttachment) error {\n\trc, ok := rctx.(replyContext)\n\tif !ok {\n\t\treturn fmt.Errorf(\"%s: SendImage: invalid reply context type %T\", p.tag(), rctx)\n\t}\n\n\timageKey, err := p.uploadImageKey(ctx, img.Data)\n\tif err != nil {\n\t\treturn err\n\t}\n\timageContent, err := (&larkim.MessageImage{ImageKey: imageKey}).String()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%s: build image message: %w\", p.tag(), err)\n\t}\n\n\treturn p.sendMediaMessage(ctx, rc, larkim.MsgTypeImage, imageContent)\n}\n\nfunc (p *Platform) uploadImageKey(ctx context.Context, data []byte) (string, error) {\n\tvar uploadResp *larkim.CreateImageResp\n\tif err := p.withTransientRetry(ctx, \"upload image\", func() error {\n\t\treturn p.withFreshTenantAccessTokenRetry(ctx, \"upload image\", func(client *lark.Client, options ...larkcore.RequestOptionFunc) error {\n\t\t\treq := larkim.NewCreateImageReqBuilder().\n\t\t\t\tBody(larkim.NewCreateImageReqBodyBuilder().\n\t\t\t\t\tImageType(\"message\").\n\t\t\t\t\tImage(bytes.NewReader(data)).\n\t\t\t\t\tBuild()).\n\t\t\t\tBuild()\n\t\t\tvar err error\n\t\t\tuploadResp, err = client.Im.Image.Create(ctx, req, options...)\n\t\t\tif err != nil {","sourceCodeStart":3257,"sourceCodeEnd":3293,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/feishu/feishu.go#L3257-L3293","documentation":"SendImage uploaded the image and obtained an imageKey, but serializing the larkim.MessageImage content to JSON failed. Wraps the serialization error before the message send; indicates an SDK-side marshaling problem, not a network issue.","triggerScenarios":"Thrown at platform/feishu/feishu.go:3275 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry; verify the returned image_key is well-formed"],"exampleFix":null,"handlingStrategy":"try-catch","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-14T05:17:10.506Z"}