{"record":{"id":"d1d63d5c853880c0","repo":"vercel/next.js","slug":"invalid-cachelife-option-either-pass-a-profil","errorCode":null,"errorMessage":"Invalid `cacheLife()` option. Either pass a profile name or object.","messagePattern":"Invalid `cacheLife\\(\\)` option\\. Either pass a profile name or object\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/next/src/server/use-cache/cache-life.ts","lineNumber":88,"sourceCode":"            `Did you mean \"${profile.trim()}\" without the spaces?`\n        )\n      }\n      throw new Error(\n        `Unknown \\`cacheLife()\\` profile \"${profile}\" is not configured in next.config.js\\n` +\n          'module.exports = {\\n' +\n          '  cacheLife: {\\n' +\n          `    \"${profile}\": ...\\n` +\n          '  }\\n' +\n          '}'\n      )\n    }\n    profile = configuredProfile\n  } else if (\n    typeof profile !== 'object' ||\n    profile === null ||\n    Array.isArray(profile)\n  ) {\n    throw new Error(\n      'Invalid `cacheLife()` option. Either pass a profile name or object.'\n    )\n  } else {\n    profile = validateAndNormalizeCacheLifeProfile(profile, { kind: 'inline' })\n  }\n\n  if (profile.revalidate !== undefined) {\n    // Track the explicit revalidate time.\n    if (\n      workUnitStore.explicitRevalidate === undefined ||\n      workUnitStore.explicitRevalidate > profile.revalidate\n    ) {\n      workUnitStore.explicitRevalidate = profile.revalidate\n    }\n  }\n  if (profile.expire !== undefined) {\n    // Track the explicit expire time.\n    if (","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/vercel/next.js/blob/258b1c1bc05f7099816b88f70b7b3422b24a4b8d/packages/next/src/server/use-cache/cache-life.ts#L70-L106","documentation":"Type guard in cacheLife() for the non-string branch: the argument is neither a string profile name nor a plain object — it is null, an array, or another non-object type. The function only accepts a profile name or a cacheLife options object, so anything else is rejected before any profile resolution happens.","triggerScenarios":"cacheLife() receives an argument that is neither a profile name nor an object.","commonSituations":"Passing a number, boolean, or null to cacheLife().","solutions":["Pass a profile name string or a config object to cacheLife()."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"258b1c1bc05f7099816b88f70b7b3422b24a4b8d","analyzedAt":"2026-08-19T02:10:13.922Z","contentChangedAt":"2026-08-19T02:10:13.922Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}