Skip to content

fix(cloudflare/workers): type createRoute code 10019 as RouteScriptNotFound#368

Merged
sam-goodwin merged 2 commits into
mainfrom
fix/cloudflare-create-route-worker-not-found
Jul 8, 2026
Merged

fix(cloudflare/workers): type createRoute code 10019 as RouteScriptNotFound#368
sam-goodwin merged 2 commits into
mainfrom
fix/cloudflare-create-route-worker-not-found

Conversation

@sam-goodwin

@sam-goodwin sam-goodwin commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

POST /zones/{zone}/workers/routes rejects with code 10019 when the referenced script does not exist (probed live):

{ "code": 10019, "message": "Cannot configure a route for a Worker which does not exist. Please ensure this Worker exists and try again." }

Type it as a dedicated RouteScriptNotFound tag scoped to createRoute so consumers can retry the create-route-right-after-put-script propagation race on a typed tag instead of UnknownCloudflareError:

 export type CreateRouteError =
   | DefaultErrors
+  | RouteScriptNotFound
   | InvalidRoutePattern
   | InvalidRoute
   | Forbidden;

A dedicated tag rather than widening the shared WorkerNotFound matcher list: WorkerNotFound is declared by ~38 workers operations, and code 10019 is only verified for createRoute — Cloudflare error codes are not unique across endpoint families (KV uses 10019 for a missing title).

Needed by alchemy-run/alchemy-effect#438 (Worker routes prop).

POST /zones/{zone}/workers/routes rejects with code 10019 ("Cannot
configure a route for a Worker which does not exist") when the script
has not propagated yet — probed live. Surface it as the existing
WorkerNotFound tag so consumers can retry the propagation race without
catching UnknownCloudflareError.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sam-goodwin added a commit to alchemy-run/alchemy-effect that referenced this pull request Jul 8, 2026
Probed live: creating a route for a not-yet-propagated script rejects
with code 10019, now typed as WorkerNotFound via distilled patch
(alchemy-run/distilled#368). Drop the speculative InternalServerError /
UnknownCloudflareError retry.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@alchemy-version-bot

alchemy-version-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Install the packages built from this commit:

@distilled.cloud/core

bun add @distilled.cloud/core@https://pkg.distilled.cloud/core/8e6eb0c

@distilled.cloud/cloudflare

bun add @distilled.cloud/cloudflare@https://pkg.distilled.cloud/cloudflare/8e6eb0c

…RouteScriptNotFound tag

WorkerNotFound is shared by ~38 workers operations; widening its
matcher list to code 10019 would relabel that code everywhere the tag
is declared, and 10019 is only verified for createRoute (codes are not
unique across endpoint families — KV uses 10019 for TitleRequired).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sam-goodwin added a commit to alchemy-run/alchemy-effect that referenced this pull request Jul 8, 2026
…tFound tag

Scoped tag instead of widening the shared WorkerNotFound matchers
(alchemy-run/distilled#368).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sam-goodwin sam-goodwin changed the title fix(cloudflare/workers): type createRoute code 10019 as WorkerNotFound fix(cloudflare/workers): type createRoute code 10019 as RouteScriptNotFound Jul 8, 2026
@sam-goodwin sam-goodwin merged commit b8d025d into main Jul 8, 2026
25 of 26 checks passed
@sam-goodwin sam-goodwin deleted the fix/cloudflare-create-route-worker-not-found branch July 8, 2026 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant