chenhg5/cc-connect · error

matrix: whoami: %w

Error message

matrix: whoami: %w

What it means

The Whoami call used to validate the access token and obtain the device ID (required for E2EE) failed. Wraps the mautrix error; means the token is revoked/expired or the homeserver is unreachable at connection setup.

Source

Thrown at platform/matrix/matrix.go:202

			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() {
		return nil
	}

	gen, ok := p.publishClient(client, selfUserID)
	if !ok {
		return nil
	}

	// Initialize E2EE crypto helper

View on GitHub (pinned to 4000b2338a)

Solutions

  1. On 401 the token was revoked — issue a new access_token
  2. Check homeserver availability
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at platform/matrix/matrix.go:202 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/94df286c340eb43b. Report an issue: GitHub.