{"record":{"id":"5c74ea3f76c297bb","repo":"nextauthjs/next-auth","slug":"verification-token-not-found","errorCode":null,"errorMessage":"Verification Token not found","messagePattern":"Verification Token not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/adapter-surrealdb/src/index.ts","lineNumber":532,"sourceCode":"        if (authenticatorDoc.length) {\n          return docToAuthenticator(authenticatorDoc[0])\n        }\n      } catch {}\n      return null\n    },\n    async listAuthenticatorsByUserId(userId: AdapterAuthenticator[\"userId\"]) {\n      const surreal = await client\n      try {\n        const [authenticatorDocs] = await surreal.query<[AuthenticatorDoc[]]>(\n          `SELECT * FROM authenticator WHERE userId = $userId LIMIT 1`,\n          {\n            userId,\n          }\n        )\n\n        return authenticatorDocs.map((v) => docToAuthenticator(v))\n      } catch {}\n      throw new Error(\"Verification Token not found\")\n    },\n    async updateAuthenticatorCounter(\n      credentialId: AdapterAuthenticator[\"credentialID\"],\n      newCounter: AdapterAuthenticator[\"counter\"]\n    ) {\n      try {\n        if (!credentialId) throw new Error(\"credential id is required\")\n        const surreal = await client\n        const [authenticatorDoc] = await surreal.query<[AuthenticatorDoc]>(\n          `UPDATE ONLY authenticator MERGE $doc WHERE credentialID = $cid`,\n          {\n            cid: credentialId,\n            doc: {\n              counter: newCounter,\n            },\n          }\n        )\n        return docToAuthenticator(authenticatorDoc)","sourceCodeStart":514,"sourceCodeEnd":550,"githubUrl":"https://github.com/nextauthjs/next-auth/blob/a1a16a5a7780488c7449feece410033f445d0b31/packages/adapter-surrealdb/src/index.ts#L514-L550","documentation":"Despite its message, this error is thrown at the end of listAuthenticatorsByUserId() — a copy-paste mislabeled message. When the query for authenticators belonging to a user throws, the adapter throws 'Verification Token not found'. The underlying cause is swallowed by `catch {}`.","triggerScenarios":"SELECT * FROM authenticator WHERE userId = $userId throws (connection/permission); authenticatorDocs is undefined so .map() throws a TypeError caught by the empty catch and converted to this error.","commonSituations":"WebAuthn sign-in listing a user's passkeys while the authenticator table is missing or permissions deny SELECT; userId type/format mismatch with stored docs; copy-paste bug makes debugging confusing because the message points at verification tokens.","solutions":["Ignore the message text — debug the authenticator table and userId instead","Verify the `authenticator` table exists and the adapter can SELECT from it","Check the userId passed matches stored doc userId values (same id format)","Note the message is a copy-paste bug in the adapter; log inside the try to see the real error"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!userId) throw new Error('listAuthenticatorsByUserId requires a userId')","typeGuard":null,"tryCatchPattern":"try {\n  return await adapter.listAuthenticatorsByUserId(userId)\n} catch (e) {\n  // NOTE: message says 'Verification Token not found' but failure is in authenticator listing\n  console.error('listAuthenticatorsByUserId failed (misleading message)', e)\n  return [] // or rethrow depending on flow\n}","preventionTips":["Remember this message is a copy-paste bug — don't chase verification-token issues","Grant SELECT on the authenticator table for the adapter user","Confirm userId format matches stored docs before querying"],"tags":["adapter","webauthn","copy-paste-bug","surrealdb"],"backgroundTag":"adapter-query-failed","analyzedSha":"a1a16a5a7780488c7449feece410033f445d0b31","analyzedAt":"2026-08-28T21:52:38.200Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}