{"record":{"id":"8cac7ee0a5aa516d","repo":"nextauthjs/next-auth","slug":"name-value-could-not-be-parsed","errorCode":null,"errorMessage":"${name} value could not be parsed","messagePattern":"(.+?) value could not be parsed","errorType":"exception","errorClass":"InvalidCheck","httpStatus":null,"severity":"error","filePath":"packages/core/src/lib/actions/callback/oauth/checks.ts","lineNumber":84,"sourceCode":"    logger.debug(`PARSE_${name.toUpperCase()}`, { cookie: value })\n\n    if (!value) throw new InvalidCheck(`${name} cookie was missing`)\n    const parsed = await decode<CookiePayload>({\n      ...jwt,\n      token: value,\n      salt: cookies[name].name,\n    })\n    if (!parsed?.value) throw new Error(\"Invalid cookie\")\n    // The check must have been created by the provider currently handling\n    // the callback.\n    if (parsed.provider !== options.provider?.id) {\n      throw new Error(\n        `${name} cookie was created for a different provider than the one handling the callback`\n      )\n    }\n    return parsed.value\n  } catch (error) {\n    throw new InvalidCheck(`${name} value could not be parsed`, {\n      cause: error,\n    })\n  }\n}\n\nfunction clearCookie(\n  name: keyof CookiesOptions,\n  options: InternalOptions,\n  resCookies: Cookie[]\n) {\n  const { logger, cookies } = options\n  const cookie = cookies[name]\n  logger.debug(`CLEAR_${name.toUpperCase()}`, { cookie })\n  resCookies.push({\n    name: cookie.name,\n    value: \"\",\n    options: { ...cookies[name].options, maxAge: 0 },\n  })","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/nextauthjs/next-auth/blob/a1a16a5a7780488c7449feece410033f445d0b31/packages/core/src/lib/actions/callback/oauth/checks.ts#L66-L102","documentation":"The catch-all of parseCookie: any failure in decoding or validating the check cookie (missing, undecodable, wrong provider) is rethrown as InvalidCheck(\"<name> value could not be parsed\") with the original error as `cause`. It normalizes all cookie parse failures into one error type.","triggerScenarios":"Any underlying throw inside parseCookie — JWT decode failure with the configured secret/salt, \"Invalid cookie\", provider mismatch, or decode() rejecting — is wrapped and rethrown with this message.","commonSituations":"Same as underlying causes: rotated/mismatched AUTH_SECRET across instances, corrupted or truncated cookies, cross-provider callback, expired/invalidated in-flight flows after a deploy.","solutions":["Inspect error.cause to find the real reason (decode failure vs provider mismatch).","Use one fixed AUTH_SECRET shared by every server instance and persist it across deploys.","Retry the sign-in flow to get a fresh cookie set.","Check middleware/proxies for cookie mutation or size truncation."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!process.env.AUTH_SECRET) throw new Error(\"Set a stable AUTH_SECRET\")","typeGuard":null,"tryCatchPattern":"try {\n  await auth()\n} catch (e) {\n  if (e?.message?.endsWith(\"value could not be parsed\")) {\n    console.error(\"Check cookie failed:\", e.cause) // inspect real cause\n  }\n}","preventionTips":["Always inspect error.cause — this error is a wrapper","Share one AUTH_SECRET across instances","Restart sign-in flows rather than reusing stale cookies"],"tags":["oauth","cookies","jwt-decode","wrapper-error"],"backgroundTag":"oauth-check-cookie-unparseable","analyzedSha":"a1a16a5a7780488c7449feece410033f445d0b31","analyzedAt":"2026-08-28T21:52:38.200Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}