{"record":{"id":"b4ba42315689be70","repo":"chenhg5/cc-connect","slug":"own-device-identity-not-found","errorCode":null,"errorMessage":"own device identity not found","messagePattern":"own device identity not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/matrix/verification.go","lineNumber":391,"sourceCode":"\t\t\tuserID = client.UserID.String()\n\t\t}\n\t\treturn &mautrix.ReqUIAuthLogin{\n\t\t\tBaseAuthData: mautrix.BaseAuthData{\n\t\t\t\tType:    mautrix.AuthTypePassword,\n\t\t\t\tSession: uiResp.Session,\n\t\t\t},\n\t\t\tUser:     userID,\n\t\t\tPassword: p.crossSigningPassword,\n\t\t}\n\t}\n\tslog.Warn(\"matrix: no supported UIA flow for cross-signing; consider setting cross_signing_password in config\", \"flows\", uiResp.Flows)\n\treturn nil\n}\n\nfunc (p *Platform) crossSignOwnDeviceErr(ctx context.Context, mach *crypto.OlmMachine) error {\n\townDevice := mach.OwnIdentity()\n\tif ownDevice == nil {\n\t\treturn fmt.Errorf(\"own device identity not found\")\n\t}\n\treturn mach.SignOwnDevice(ctx, ownDevice)\n}\n\nfunc (p *Platform) crossSignOwnDevice(ctx context.Context, mach *crypto.OlmMachine) {\n\townDevice := mach.OwnIdentity()\n\tif ownDevice == nil {\n\t\tslog.Warn(\"matrix: own device identity not found, skipping self-sign\")\n\t\treturn\n\t}\n\tif err := mach.SignOwnDevice(ctx, ownDevice); err != nil {\n\t\tslog.Warn(\"matrix: failed to sign own device\", \"error\", err)\n\t} else {\n\t\tslog.Info(\"matrix: cross-signed own device\", \"device\", ownDevice.DeviceID)\n\t}\n}\n","sourceCodeStart":373,"sourceCodeEnd":408,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/matrix/verification.go#L373-L408","documentation":"crossSignOwnDeviceErr fails with \"own device identity not found\" when the OlmMachine's OwnIdentity() returns nil, meaning the crypto machine has no stored identity (curve25519/ed25519 keys) for the bot's own device. Signing the device is impossible without its own identity. Called by setupCrossSigning after cross-signing bootstrap.","triggerScenarios":"mach.OwnIdentity() returns nil during crossSignOwnDeviceErr — the local device's identity keys are not in the crypto store, typically because device key upload never completed or the store lacks the own-device record.","commonSituations":"Fresh crypto store before the first keys-upload sync completed; crypto store created under a different user/device and reused incorrectly; interrupted E2EE bootstrap left the store half-initialized; cross-signing seeds were restored but the own-device identity was never saved.","solutions":["Ensure device keys were uploaded to the homeserver (/keys/upload) before signing — check earlier initE2EE logs","Let one full sync complete after store creation before cross-signing; add a retry after the initial sync","If the store is inconsistent, back it up and delete it so a fresh bootstrap re-creates identities (re-verify devices afterwards)","Verify the crypto store belongs to the same user_id/device_id as the current client"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if mach.OwnIdentity() == nil {\n    // wait for initial sync / key upload, then retry\n}","typeGuard":"func ownIdentityReady(mach *crypto.OlmMachine) bool { return mach.OwnIdentity() != nil }","tryCatchPattern":"if err := p.crossSignOwnDeviceErr(ctx, mach); err != nil {\n    if err.Error() == \"own device identity not found\" {\n        // retry after keys upload + first sync\n        return\n    }\n    slog.Error(\"cross-signing own device failed\", \"err\", err)\n}","preventionTips":["Confirm /keys/upload succeeded before signing","Use a crypto store dedicated to this user_id/device_id","Re-bootstrap the store if it was created under a different account"],"tags":["matrix","e2ee","cross-signing","olm","device-identity"],"backgroundTag":"entity-not-found","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"}