sipeed/picoclaw · error

create matrix client

Error message

create matrix client: %w

What it means

Fired in NewMatrixChannel when mautrix.NewClient fails to construct the Matrix client for the given homeserver, user ID, and access token. Typically means the homeserver URL is malformed or unparseable; channel creation aborts with the underlying error wrapped.

Solutions

  1. Check the homeserver URL is a valid, reachable https URL
  2. Verify user_id and access_token formats (@user:server and mautrix-accepted token)
  3. Fix the config values and re-create the channel
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/channels/matrix/matrix.go:226 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15). Data as JSON: /api/errors/ca13fecb1b57c1ea. Report an issue: GitHub.

Appendix: source

Thrown at pkg/channels/matrix/matrix.go:226

	messageBus *bus.MessageBus,
	cryptoDatabasePath string,
) (*MatrixChannel, error) {
	homeserver := strings.TrimSpace(cfg.Homeserver)
	userID := strings.TrimSpace(cfg.UserID)
	accessToken := strings.TrimSpace(cfg.AccessToken.String())
	if homeserver == "" {
		return nil, fmt.Errorf("matrix homeserver is required")
	}
	if userID == "" {
		return nil, fmt.Errorf("matrix user_id is required")
	}
	if accessToken == "" {
		return nil, fmt.Errorf("matrix access_token is required")
	}

	client, err := mautrix.NewClient(homeserver, id.UserID(userID), accessToken)
	if err != nil {
		return nil, fmt.Errorf("create matrix client: %w", err)
	}
	if cfg.DeviceID != "" {
		client.DeviceID = id.DeviceID(cfg.DeviceID)
	}

	syncer, ok := client.Syncer.(*mautrix.DefaultSyncer)
	if !ok {
		return nil, fmt.Errorf("matrix syncer is not *mautrix.DefaultSyncer")
	}

	base := channels.NewBaseChannel(
		"matrix",
		cfg,
		messageBus,
		bc.AllowFrom,
		channels.WithMaxMessageLength(65536),
		channels.WithGroupTrigger(bc.GroupTrigger),
		channels.WithReasoningChannelID(bc.ReasoningChannelID),

View on GitHub (pinned to 49183d7e8d)