sipeed/picoclaw · error
feishu image upload: no image_key returned
Error message
feishu image upload: no image_key returned
What it means
The image upload returned Success()==true but Data or Data.ImageKey is nil — an unexpected payload where the API claims success yet delivers no image_key. This is a protocol deviation (gateway quirk or SDK/response-shape mismatch), not a normal input error; there is nothing in the request to fix.
Source
Thrown at pkg/channels/feishu/feishu_64.go:1156
func (c *FeishuChannel) sendImage(ctx context.Context, chatID string, file *os.File) error {
// Upload image to get image_key
uploadReq := larkim.NewCreateImageReqBuilder().
Body(larkim.NewCreateImageReqBodyBuilder().
ImageType("message").
Image(file).
Build()).
Build()
uploadResp, err := c.client.Im.V1.Image.Create(ctx, uploadReq)
if err != nil {
return fmt.Errorf("feishu image upload: %w", err)
}
if !uploadResp.Success() {
c.invalidateTokenOnAuthError(uploadResp.Code)
return fmt.Errorf("feishu image upload api error (code=%d msg=%s)", uploadResp.Code, uploadResp.Msg)
}
if uploadResp.Data == nil || uploadResp.Data.ImageKey == nil {
return fmt.Errorf("feishu image upload: no image_key returned")
}
imageKey := *uploadResp.Data.ImageKey
// Send image message
content, _ := json.Marshal(map[string]string{"image_key": imageKey})
req := larkim.NewCreateMessageReqBuilder().
ReceiveIdType(larkim.CreateMessageV1ReceiveIDTypeChatId).
Body(larkim.NewCreateMessageReqBodyBuilder().
ReceiveId(chatID).
MsgType(larkim.MsgTypeImage).
Content(string(content)).
Build()).
Build()
resp, err := c.client.Im.V1.Message.Create(ctx, req)
if err != nil {
return fmt.Errorf("feishu image send: %w", err)View on GitHub (pinned to 49183d7e8d)
Solutions
- Retry the upload once — the condition is typically transient.
- Pin/upgrade the lark oapi SDK to a version tested against the current Feishu response schema.
- Log the raw response body once to confirm data.image_key is genuinely absent (rules out SDK parsing).
- If reproducible, file it with Feishu open-platform support including the request ID.
Defensive patterns
Strategy: retry
Type guard
func isMissingImageKey(err error) bool {
return strings.Contains(err.Error(), "feishu image upload: no image_key returned")
} Try / catch
if err := ch.SendMedia(ctx, msg); err != nil {
if isMissingImageKey(err) {
// unexpected empty payload: retry once; if it repeats, suspect SDK/API schema drift
}
} Prevention
- Pin the lark oapi SDK version in go.mod
- Retry once on empty-payload errors — they are usually gateway-transient
- Log raw upload responses during integration to catch schema drift early
When it happens
Trigger: Im.V1.Image.Create succeeds with an empty data block; occasionally seen under Feishu gateway incidents, or when the vendored lark SDK version deserializes the response shape differently than the live API emits.
Common situations: After upgrading the github.com/larksuite/oapi-sdk-go dependency; during transient Feishu service degradation; region-specific API behavior differences.
Related errors
- feishu file upload: no file_key returned
- feishu image upload: %w
- feishu image upload api error (code=%d msg=%s)
- feishu image send: %w
- feishu image send api error (code=%d msg=%s)
AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15).
Data as JSON: /api/errors/2df889dd044d4d3c.
Report an issue: GitHub.