{"record":{"id":"450cac6c6b2bb9cc","repo":"chenhg5/cc-connect","slug":"s-build-video-message-w","errorCode":null,"errorMessage":"%s: build video message: %w","messagePattern":"(.+?): build video message: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/feishu/feishu.go","lineNumber":5587,"sourceCode":"\t\t\tif !uploadResp.Success() {\n\t\t\t\treturn fmt.Errorf(\"%s: upload video code=%d msg=%s\", p.tag(), uploadResp.Code, uploadResp.Msg)\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t}); err != nil {\n\t\treturn err\n\t}\n\tif uploadResp.Data == nil || uploadResp.Data.FileKey == nil {\n\t\treturn fmt.Errorf(\"%s: upload video: no file_key returned\", p.tag())\n\t}\n\tfileKey := *uploadResp.Data.FileKey\n\n\tslog.Debug(p.tag()+\": video uploaded\", \"file_key\", fileKey, \"format\", format, \"size\", len(video))\n\n\tmediaMsg := larkim.MessageMedia{FileKey: fileKey}\n\tmediaContent, err := mediaMsg.String()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%s: build video message: %w\", p.tag(), err)\n\t}\n\n\treturn p.sendMediaMessage(ctx, rc, larkim.MsgTypeMedia, mediaContent)\n}\n\ntype postElement struct {\n\tTag      string `json:\"tag\"`\n\tText     string `json:\"text,omitempty\"`\n\tLanguage string `json:\"language,omitempty\"`\n\tImageKey string `json:\"image_key,omitempty\"`\n\tHref     string `json:\"href,omitempty\"`\n\tUserId   string `json:\"user_id,omitempty\"`\n\tUserName string `json:\"user_name,omitempty\"`\n}\n\ntype postLang struct {\n\tTitle   string          `json:\"title\"`\n\tContent [][]postElement `json:\"content\"`","sourceCodeStart":5569,"sourceCodeEnd":5605,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/feishu/feishu.go#L5569-L5605","documentation":"Failed to serialize the larkim.MessageMedia struct (containing the uploaded file_key) into the JSON message content string via mediaMsg.String(). This is a local JSON-marshalling failure, not an API failure.","triggerScenarios":"mediaMsg.String() returns an error, which for larkim.MessageContent implementations is practically only a json.Marshal failure — essentially never with a plain FileKey string field.","commonSituations":"Extremely rare in practice; could indicate a corrupted SDK install or a custom MessageMedia build with unmarshalable fields.","solutions":["Upgrade/reinstall the Feishu SDK — a stock MessageMedia with a valid fileKey always marshals","Verify fileKey contains only the plain key string (no control characters injected)","Check vendor directory integrity (go mod verify)","If it persists, replace mediaMsg.String() with explicit json.Marshal of a map for debugging"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"content, err := mediaMsg.String()\nif err != nil {\n    slog.Error(\"media marshal failed\", \"err\", err)\n    return err\n}","preventionTips":["Run go mod verify to catch corrupted SDK installs","Never inject control characters into fileKey"],"tags":["feishu","json","marshal","video"],"backgroundTag":"json-marshal-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"}