{"record":{"id":"ce20d1209a8f7875","repo":"chenhg5/cc-connect","slug":"webex-postfile-status-d","errorCode":null,"errorMessage":"webex: postFile status %d","messagePattern":"webex: postFile status (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/webex/client.go","lineNumber":246,"sourceCode":"\t\tname = \"attachment\"\n\t}\n\tpart, err := w.CreateFormFile(\"files\", name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err := part.Write(f.Data); err != nil {\n\t\treturn err\n\t}\n\tif err := w.Close(); err != nil {\n\t\treturn err\n\t}\n\tresp, err := c.doWithRetry(ctx, http.MethodPost, c.base()+\"/messages\", buf.Bytes(), w.FormDataContentType(), \"webex: postFile\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\tif resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {\n\t\treturn fmt.Errorf(\"webex: postFile status %d\", resp.StatusCode)\n\t}\n\treturn nil\n}\n","sourceCodeStart":228,"sourceCodeEnd":250,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/webex/client.go#L228-L250","documentation":"The multipart upload POST to /messages (files form field) finished but the status was not 200 or 201. This is the file/attachment counterpart of postMessage's status guard: Webex rejected the upload, e.g. oversized file (413), unsupported media type, invalid roomId, or an auth failure — transport-level failures were already handled inside doWithRetry.","triggerScenarios":"Multipart upload rejected: 400 (unsupported file type or size >100MB), 401 (token), 404 (bot not in room), 429 (rate limit), 5xx during upload.","commonSituations":"Uploading oversized files; Webex-restricted MIME types (e.g. executable formats); slow uploads hitting gateway timeouts; bot removed from target room.","solutions":["Check the file size — keep under Webex's ~100MB limit, and compress if needed","Verify the MIME type is supported by Webex messaging (no arbitrary executables)","Confirm the bot is a member of the target room (404 case)","Retry with backoff on 429/5xx"],"exampleFix":"// before\nerr := client.PostFile(ctx, roomID, largeFile)\n// after\nif len(largeFile.Data) > 100*1024*1024 {\n    return fmt.Errorf(\"file too large for webex\")\n}\nerr := client.PostFile(ctx, roomID, largeFile)","handlingStrategy":"validation","validationCode":"if len(f.Data) > 100*1024*1024 { return errors.New(\"file exceeds webex 100MB limit\") }","typeGuard":null,"tryCatchPattern":"err := client.PostFile(ctx, roomID, f)\nif err != nil {\n    if strings.Contains(err.Error(), \"status 400\") { return fmt.Errorf(\"unsupported file: %w\", err) }\n    return retryWithBackoff(err)\n}","preventionTips":["Pre-check file size and MIME type against Webex limits","Compress or link large files instead of uploading","Confirm bot membership in the target room","Retry only transient statuses (429/5xx)"],"tags":["webex","http","upload","multipart"],"backgroundTag":"http-error-response","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"}