{"record":{"id":"f812a3b94cc922c3","repo":"chenhg5/cc-connect","slug":"matrix-create-client-w","errorCode":null,"errorMessage":"matrix: create client: %w","messagePattern":"matrix: create client: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/matrix/matrix.go","lineNumber":193,"sourceCode":"\t\tif err != nil {\n\t\t\tslog.Warn(\"matrix: connection error, retrying\", \"error\", core.RedactToken(err.Error(), p.accessToken), \"backoff\", wait)\n\t\t\tp.notifyUnavailable(err)\n\t\t}\n\n\t\ttimer := time.NewTimer(wait)\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\ttimer.Stop()\n\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() {","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/matrix/matrix.go#L175-L211","documentation":"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.","triggerScenarios":"Thrown at platform/matrix/matrix.go:193 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the homeserver URL and access token (Whoami)","Fix credentials to stop the reconnect backoff loop"],"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"}