The error, verbatim
Jump to the fix ↓X [ERROR] A request to the Cloudflare API (/accounts/.../workers/scripts/nk-repro-cpu) failed.
The uploaded script has no registered event handlers. Please visit the following website for more information: https://developers.cloudflare.com/workers/runtime-apis/handlers/. [code: 10068]
# a Worker file with no export at all:
No event handlers were registered. This script does nothing.
[code: 10021]
Tested on
- wrangler
- 4.139.0
- Worker
- compatibility_date 2026-09-01
- OS
- Windows 11 Pro
Contents
Cloudflare checks every upload for at least one handler it can call, such as fetch. If it can’t find one, wrangler deploy stops. The catch is that it only recognises handlers written a specific way, and one common mistake passes the check and fails later, for every visitor.
The fix
Export your handler as the default export, as an object with a fetch method:
export default {
async fetch(request) {
return new Response('hello');
},
};If your Worker uses the older service-worker style, the event name has to be exactly fetch:
addEventListener('fetch', (event) => {
event.respondWith(new Response('hello'));
});Three ways it goes wrong
I deployed each of these to a real test Worker with wrangler 4.139.0:
| The file | What happened |
|---|---|
addEventListener('fecth', …), one letter swapped |
rejected: The uploaded script has no registered event handlers [code: 10068] |
a fetch function that’s never exported |
rejected: No event handlers were registered. This script does nothing. [code: 10021] |
export async function fetch(request) { … } |
deployed, then every request got a 404 |
The last one is the nasty one. A named export called fetch isn’t a handler, only the default export is, but the upload goes through with no warning. Visiting the Worker then shows Cloudflare’s placeholder page with HTTP 404:
Page not found
There is nothing here yet
If you expect something to be here, it may take some time.
Please check back again later.
How this was tested
Five small Worker files deployed to one test Worker on workers.dev with wrangler 4.139.0 and compatibility_date 2026-09-01: a misspelled addEventListener, an unexported fetch, a named fetch export, a default export, and a correct addEventListener('fetch'). The rejections are copied from wrangler’s output, and the 404 page and the hello responses from requests to the deployed Worker. When a Worker already runs, a rejected upload leaves it running the previous version.
— N.K., end of entry No.034