Startup Time Exceeded Despite CPU Profile Showing <400ms

Hey all, I'm running into a weird issue while deploying a Worker. I’m getting an error saying my Worker exceeds startup limits:
✘ [ERROR] Your Worker failed validation because it exceeded startup limits.
To ensure fast responses, there are constraints on Worker startup, such as how much CPU it can use, or how long it can take. Your Worker has hit one of these startup limits...
However, when I check the .cpuprofile, the total time seems to be around 281ms which is well under the 400ms limit for Workers startup. The flamegraph also shows the bulk of the time in functions like _Tiktoken (146.46ms), toByteArray (17.63ms), and some anonymous functions, with garbage collection taking 48.27ms. I’ve also attached a screenshot of the flamegraph and the performance breakdown. The heaviest operations seem to be in _Tiktoken and some dependency initialization (e.g., pg, pino-pretty, @libsql/client), but I don’t understand why it’s failing validation if the total time is under 400ms. Could this be related to CPU usage limits rather than time? Any tips on optimizing or debugging this further? Thanks!
2 Replies
stochastic
stochasticOP2w ago
Here's the .cpuprofile if anyone's interested.
stochastic
stochasticOP2w ago
Wrangler spits it out when check startup time fails during deploy. You can also get one with with wrangler check startup My concern is wrangler deploys are failing because of it. So the .cpuprofile it gives me, showing 258ms start time is based on my machine? That’s not confusing at all Oh because it’s a high resolution timer. Interesting.

Did you find this page helpful?