{"record":{"id":"f7a6e052e24ebe03","repo":"chenhg5/cc-connect","slug":"matrix-upload-file-w","errorCode":null,"errorMessage":"matrix: upload file: %w","messagePattern":"matrix: upload file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/matrix/matrix.go","lineNumber":523,"sourceCode":"\t\treturn fmt.Errorf(\"matrix: not connected\")\n\t}\n\n\tmime := file.MimeType\n\tif mime == \"\" {\n\t\tmime = \"application/octet-stream\"\n\t}\n\tname := file.FileName\n\tif name == \"\" {\n\t\tname = \"attachment\"\n\t}\n\n\turi, err := client.UploadMedia(ctx, mautrix.ReqUploadMedia{\n\t\tContentBytes: file.Data,\n\t\tContentType:  mime,\n\t\tFileName:     name,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"matrix: upload file: %w\", err)\n\t}\n\n\tcontent := &event.MessageEventContent{\n\t\tMsgType: event.MsgFile,\n\t\tBody:    name,\n\t\tInfo: &event.FileInfo{\n\t\t\tMimeType: mime,\n\t\t\tSize:     len(file.Data),\n\t\t},\n\t}\n\tif !uri.ContentURI.IsEmpty() {\n\t\tcontent.URL = uri.ContentURI.CUString()\n\t} else {\n\t\tcontent.File = &event.EncryptedFileInfo{\n\t\t\tURL: uri.ContentURI.CUString(),\n\t\t}\n\t}\n","sourceCodeStart":505,"sourceCodeEnd":541,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/matrix/matrix.go#L505-L541","documentation":"Wrapped error from mautrix client.UploadMedia when uploading generic file bytes to the Matrix content repository; the media upload call failed before an mxc URI was returned.","triggerScenarios":"Thrown at platform/matrix/matrix.go:523 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the file against the homeserver max upload size","Verify credentials and retry"],"exampleFix":null,"handlingStrategy":"retry","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"}