chenhg5/cc-connect · error
matrix: create client: %w
Error message
matrix: create client: %w
What it means
runConnection could not construct the mautrix Matrix client — typically an invalid homeserver URL. Wraps mautrix.NewClient's error; the connection loop will surface this instead of retrying an unusable config.
Source
Thrown at platform/matrix/matrix.go:193
if err != nil {
slog.Warn("matrix: connection error, retrying", "error", core.RedactToken(err.Error(), p.accessToken), "backoff", wait)
p.notifyUnavailable(err)
}
timer := time.NewTimer(wait)
select {
case <-ctx.Done():
timer.Stop()
return
case <-timer.C:
}
}
}
func (p *Platform) runConnection(ctx context.Context) error {
client, err := mautrix.NewClient(p.homeserver, "", p.accessToken)
if err != nil {
return fmt.Errorf("matrix: create client: %w", err)
}
client.Client = p.httpClient
// Always call Whoami to validate token and get device ID (needed for E2EE)
selfUserID := id.UserID(p.userID)
var deviceID id.DeviceID
resp, err := client.Whoami(ctx)
if err != nil {
return fmt.Errorf("matrix: whoami: %w", err)
}
if selfUserID == "" {
selfUserID = resp.UserID
}
deviceID = resp.DeviceID
client.UserID = selfUserID
client.DeviceID = deviceID
if ctx.Err() != nil || p.isStopping() {View on GitHub (pinned to 4000b2338a)
Solutions
- Verify the homeserver URL and access token (Whoami)
- Fix credentials to stop the reconnect backoff loop
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at platform/matrix/matrix.go:193 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/f812a3b94cc922c3.
Report an issue: GitHub.