{"record":{"id":"87d12fb7adf711c6","repo":"sveltejs/kit","slug":"cloudflare-pages-functions-includes-excludes-exce","errorCode":null,"errorMessage":"Cloudflare Pages Functions' includes/excludes exceeds _routes.json limits (see https://developers.cloudflare.com/pages/platform/functions/routing/#limits). Dropping ${excess} exclude rules — this will cause unnecessary function invocations.","messagePattern":"Cloudflare Pages Functions' includes/excludes exceeds _routes\\.json limits \\(see https://developers\\.cloudflare\\.com/pages/platform/functions/routing/#limits\\)\\. Dropping (.+?) exclude rules — this will cause unnecessary function invocations\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/adapter-cloudflare/utils.js","lineNumber":153,"sourceCode":"\t\t}\n\n\t\tif (rule === '<prerendered>') {\n\t\t\tbuilder.prerendered.paths.forEach((path) => excluded_routes.add(path));\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (rule === '<redirects>') {\n\t\t\tredirects.forEach((path) => excluded_routes.add(path));\n\t\t\tcontinue;\n\t\t}\n\n\t\texcluded_routes.add(rule);\n\t}\n\texclude = Array.from(excluded_routes);\n\n\tconst excess = include.length + exclude.length - 100;\n\tif (excess > 0) {\n\t\tbuilder.log.warn(\n\t\t\t`Cloudflare Pages Functions' includes/excludes exceeds _routes.json limits (see https://developers.cloudflare.com/pages/platform/functions/routing/#limits). Dropping ${excess} exclude rules — this will cause unnecessary function invocations.`\n\t\t);\n\t\texclude.length -= excess;\n\t}\n\n\treturn {\n\t\tversion: 1,\n\t\tdescription: 'Generated by @sveltejs/adapter-cloudflare',\n\t\tinclude,\n\t\texclude\n\t};\n}\n\n/**\n * Adds header rules to the contents of a `_headers` file\n * @param {string} url\n * @param {string[]} rules\n * @param {string} content","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/adapter-cloudflare/utils.js#L135-L171","documentation":"Cloudflare Pages' _routes.json allows at most 100 combined include/exclude rules. get_routes_json in the Cloudflare adapter de-duplicates the generated rules and, when the total exceeds 100, drops exclude rules from the end so the file stays valid. Dropped excludes mean those paths will match an include pattern and invoke the Functions script unnecessarily, costing extra invocations.","triggerScenarios":"Running `adapter-cloudflare`'s adapt() on a project whose generated include + exclude rule count exceeds 100 after deduplication in get_routes_json (called by adapt and routes).","commonSituations":"Large apps with many prerendered routes mixed with dynamic routes producing many exclude patterns; apps with broad include rules like /* plus lots of static asset excludes; misconfigured `routes`/`exclude` adapter options generating redundant rules.","solutions":["Reduce the number of routes or broaden include/exclude patterns so the total stays under 100.","Prerender more routes so they are excluded by fewer, broader patterns instead of many specific ones.","Consolidate static assets into fewer directories and exclude those directories wholesale.","Accept the dropped rules if the extra function invocations are tolerable (the build still succeeds)."],"exampleFix":"// before (svelte.config.js)\nconst config = { kit: { adapter: adapter({ routes: { include: ['/api/*'], exclude: ['/a', '/b', '/c', /* ...95 more */] } }) } };\n// after\nconst config = { kit: { adapter: adapter({ routes: { include: ['/api/*'], exclude: ['/*'] } }) } };","handlingStrategy":"validation","validationCode":"const includes = routes.include ?? []; const excludes = routes.exclude ?? [];\nif (includes.length + excludes.length > 100) {\n  console.warn(`_routes.json rules (${includes.length + excludes.length}) exceed 100; consolidate before building`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Count include+exclude rules in CI and fail the build above ~90 rules","Prefer broad glob excludes over many specific paths","Prerender routes so broad excludes cover them"],"tags":["cloudflare","adapter","build-warning","routing"],"backgroundTag":"routes-json-limit-exceeded","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}