Skip to content
Nilay Kabariya

Entry No.032·Deploy·Updated ·3 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. Seven handler shapes tested, Hono included.

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; Ubuntu on GitHub Actions

The fix that worked

Export the handler as the default export:

export default {
  async fetch(request) {
    return new Response('hello');
  },
};
Not it? Every cause, tested ↓

Tested on

wrangler
4.139.0 (deploys), 4.156.0 (wrangler dev)
Worker
compatibility_date 2026-09-01
Hono
4.x
OS
Windows 11 Pro; Ubuntu on GitHub Actions

✓ Last re-run on GitHub Actions · see the run · all repros

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.

What wrangler dev shows for the same mistakes

Locally the errors look different, and the worst case is silent. I ran each handler shape under wrangler dev (wrangler 4.156.0, local workerd) and requested /:

The file wrangler dev
export default { async fetch() { … } } ✅ HTTP 200 hello
export async function fetch() { … } (named export) prints Ready on http://localhost:8799, then the request never gets an answer (no error in the log, curl gave up after 20 s)
export default async function (request) { … } (a plain function) ❌ the runtime doesn’t start: Uncaught TypeError: Class extends value async function src_default(request) {…
module.exports = { async fetch() { … } } (CommonJS) ❌ the runtime doesn’t start: Uncaught ReferenceError: module is not defined
addEventListener('fecth', …) starts, then every request fails with HTTP 500 Error: No response!

So a request that hangs in wrangler dev with a clean log usually means a named fetch export: the same file that deploys and serves the 404 page above. And if the startup error mentions Class extends value, your default export is a bare function.

Wrap it in an object:

export default {
  fetch: handler, // your existing async function (request, env, ctx)
};

Both errors stop the local runtime with this line after them, which sounds like a broken install but isn’t:

✘ [ERROR] The Workers runtime failed to start. There was likely a problem with the workerd binary or your configuration.

Using Hono (or another router)

A Hono app is already a valid default export, because the app object has a fetch method. Both of these answered HTTP 200 hello under wrangler dev:

import { Hono } from "hono";
const app = new Hono();
app.get("/", (c) => c.text("hello"));

export default app;
// or, the same thing spelled out:
// export default { fetch: app.fetch };

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.

November 1, 2026: seven handler shapes (the five above plus a default-exported plain function, CommonJS module.exports, and Hono both ways) ran under wrangler dev with wrangler 4.156.0 on GitHub Actions ubuntu-latest, each answering one request to /. The plain-function and CommonJS shapes were tested locally only, not deployed. The script and the full output are public.

— N.K., end of entry No.032

Useful? Pass it on:Post on XFollow @EmotionalMatter

Related entries

  1. No.066

    Deno Deploy shutdown: move to Workers or Node, tested

    Deno Deploy closes in about six months. I moved a typical Deno Deploy app to Cloudflare Workers and to Node 26: every error, and what fixed each.

    > Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. Received protocol 'jsr:'

    DEPLOY3 min
  2. No.033

    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.

    DEPLOY4 min
  3. No.025

    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

    DEPLOY4 min

tip: paste the exact error text