chenhg5/cc-connect · error

matrix: send: %w

Error message

matrix: send: %w

What it means

Wrapped error from mautrix SendMessageEvent when sending a room event (plaintext path, after the E2EE path declined to handle it); the homeserver rejected or failed the send for replies, images, files, or message updates.

Source

Thrown at platform/matrix/matrix.go:398

	}
	handler(p, msg)
}

// sendRoomEvent sends an event to a room, encrypting it if E2EE is available and the room is encrypted.
func (p *Platform) sendRoomEvent(ctx context.Context, roomID id.RoomID, evtType event.Type, content any) error {
	client := p.getClient()
	if client == nil {
		return fmt.Errorf("matrix: not connected")
	}

	// Try E2EE path first (only available when built with goolm tag)
	if handled, err := p.tryEncryptAndSend(ctx, client, roomID, evtType, content); handled {
		return err
	}

	_, err := client.SendMessageEvent(ctx, roomID, evtType, content)
	if err != nil {
		return fmt.Errorf("matrix: send: %w", err)
	}
	return nil
}

func (p *Platform) Reply(ctx context.Context, rctx any, content string) error {
	rc, ok := rctx.(replyContext)
	if !ok {
		return fmt.Errorf("matrix: invalid reply context type %T", rctx)
	}

	parsed := format.RenderMarkdown(content, true, false)
	parsed.Body = content
	if content != "" {
		parsed.RelatesTo = &event.RelatesTo{}
		parsed.RelatesTo.SetReplyTo(rc.messageID)
	}

	return p.sendRoomEvent(ctx, rc.roomID, event.EventMessage, &parsed)

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Retry; check the bot user's room membership/permissions
  2. If the room is encrypted but built without the goolm tag, sends will keep failing
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at platform/matrix/matrix.go:398 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/9b528f70b924017d. Report an issue: GitHub.