{"record":{"id":"94df286c340eb43b","repo":"chenhg5/cc-connect","slug":"matrix-whoami-w","errorCode":null,"errorMessage":"matrix: whoami: %w","messagePattern":"matrix: whoami: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/matrix/matrix.go","lineNumber":202,"sourceCode":"\t\t\treturn\n\t\tcase <-timer.C:\n\t\t}\n\t}\n}\n\nfunc (p *Platform) runConnection(ctx context.Context) error {\n\tclient, err := mautrix.NewClient(p.homeserver, \"\", p.accessToken)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"matrix: create client: %w\", err)\n\t}\n\tclient.Client = p.httpClient\n\n\t// Always call Whoami to validate token and get device ID (needed for E2EE)\n\tselfUserID := id.UserID(p.userID)\n\tvar deviceID id.DeviceID\n\tresp, err := client.Whoami(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"matrix: whoami: %w\", err)\n\t}\n\tif selfUserID == \"\" {\n\t\tselfUserID = resp.UserID\n\t}\n\tdeviceID = resp.DeviceID\n\tclient.UserID = selfUserID\n\tclient.DeviceID = deviceID\n\n\tif ctx.Err() != nil || p.isStopping() {\n\t\treturn nil\n\t}\n\n\tgen, ok := p.publishClient(client, selfUserID)\n\tif !ok {\n\t\treturn nil\n\t}\n\n\t// Initialize E2EE crypto helper","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/matrix/matrix.go#L184-L220","documentation":"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.","triggerScenarios":"Thrown at platform/matrix/matrix.go:202 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["On 401 the token was revoked — issue a new access_token","Check homeserver availability"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}