Which page
https://developers.cloudflare.com/workers/static-assets/routing/worker-script/ (and the other pages that document run_worker_first)
What's missing
run_worker_first accepts at most 100 entries. Go over it and Wrangler refuses to start the Worker at all:
Error: Too many `run_worker_first` rules were provided;
102 rules provided exceeds max of 100.
The limit isn't on that page, and searching the docs for the error text returns nothing.
The part that costs the most time
The cap counts entries, not distinct patterns. A config with duplicates fails on its raw length, so deduplicating buys you room and the error message gives no hint that it would.
Measured on wrangler 4.125.0, wrangler deploy --dry-run:
| entries |
distinct patterns |
exit |
message |
| 100 |
100 |
0 |
starts fine |
| 102 |
102 |
1 |
102 rules provided exceeds max of 100 |
| 104 |
99 |
1 |
104 rules provided exceeds max of 100 |
That third row is the one worth documenting. 99 distinct patterns, rejected for carrying 104 entries.
Suggested addition
A line on the run_worker_first docs saying the array takes at most 100 entries and that duplicates count toward the limit. Two sentences would cover it.
Worth mentioning the practical remedy too, since it isn't obvious: check whether an existing wildcard already covers the path before adding a rule. Folding eight exact /lens rows into /lens plus /lens/* took one config from 100 to 94 with no behaviour change.
Which page
https://developers.cloudflare.com/workers/static-assets/routing/worker-script/ (and the other pages that document
run_worker_first)What's missing
run_worker_firstaccepts at most 100 entries. Go over it and Wrangler refuses to start the Worker at all:The limit isn't on that page, and searching the docs for the error text returns nothing.
The part that costs the most time
The cap counts entries, not distinct patterns. A config with duplicates fails on its raw length, so deduplicating buys you room and the error message gives no hint that it would.
Measured on wrangler 4.125.0,
wrangler deploy --dry-run:102 rules provided exceeds max of 100104 rules provided exceeds max of 100That third row is the one worth documenting. 99 distinct patterns, rejected for carrying 104 entries.
Suggested addition
A line on the
run_worker_firstdocs saying the array takes at most 100 entries and that duplicates count toward the limit. Two sentences would cover it.Worth mentioning the practical remedy too, since it isn't obvious: check whether an existing wildcard already covers the path before adding a rule. Folding eight exact
/lensrows into/lensplus/lens/*took one config from 100 to 94 with no behaviour change.