Skip to content
Nilay Kabariya

Entry No.034·Deploy··2 min read

Fix: The uploaded script has no registered event handlers

Cloudflare rejects your Worker with no registered event handlers (code 10068), or accepts it and serves a 404. Three ways it happens, tested on a deploy.

by Nilay#cloudflare#workers#wranglerDEPLOY

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]
✓ Reproduced on Windows 11 Pro

Tested on

wrangler
4.139.0
Worker
compatibility_date 2026-09-01
OS
Windows 11 Pro
Contents
  1. The fix01
  2. Three ways it goes wrong02
  3. How this was tested03

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

Useful? Pass it on:Post on XFollow @EmotionalMatter

Related entries

  1. No.035

    Fix: Script startup exceeded CPU time limit (Workers 10021)

    Cloudflare rejects your Worker deploy with Script startup exceeded CPU time limit. How to see which code is slow, and the fix that removes it, measured.

    > X [ERROR] Your Worker failed validation because it exceeded startup limits.

    DEPLOY2 min
  2. No.027

    Fix: Error 1101 Worker threw exception (Cloudflare Workers)

    Cloudflare's 1101 page hides the real error. See it with one command, plus six causes reproduced on a deployed Worker, each with its exact log message.

    > Error 1101

    DEPLOY3 min
  3. No.026

    Cloudflare 1102: Worker exceeded resource limits / CPU time limit

    Cloudflare Workers Error 1102. Why sign-ups with better-auth trip it, why it only fails sometimes, and what fixes it, measured on a deployed Worker.

    > Error 1102

    DEPLOY4 min

Post card · Newsletter

Get the next fix in your inbox.

One short email when a new entry is published. No spam, never shared, and you can leave any time.

— Nilay

or follow by RSSor on X

By subscribing you agree to the privacy note. One click to leave.

tip: paste the exact error text