chenhg5/cc-connect · error
matrix: upload file: %w
Error message
matrix: upload file: %w
What it means
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.
Source
Thrown at platform/matrix/matrix.go:523
return fmt.Errorf("matrix: not connected")
}
mime := file.MimeType
if mime == "" {
mime = "application/octet-stream"
}
name := file.FileName
if name == "" {
name = "attachment"
}
uri, err := client.UploadMedia(ctx, mautrix.ReqUploadMedia{
ContentBytes: file.Data,
ContentType: mime,
FileName: name,
})
if err != nil {
return fmt.Errorf("matrix: upload file: %w", err)
}
content := &event.MessageEventContent{
MsgType: event.MsgFile,
Body: name,
Info: &event.FileInfo{
MimeType: mime,
Size: len(file.Data),
},
}
if !uri.ContentURI.IsEmpty() {
content.URL = uri.ContentURI.CUString()
} else {
content.File = &event.EncryptedFileInfo{
URL: uri.ContentURI.CUString(),
}
}
View on GitHub (pinned to 4000b2338a)
Solutions
- Check the file against the homeserver max upload size
- Verify credentials and retry
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at platform/matrix/matrix.go:523 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/f7a6e052e24ebe03.
Report an issue: GitHub.