Skip to content

docs: document error codes and remove docs typecheck import inference#1445

Draft
pranaygp wants to merge 7 commits intomainfrom
pgp/error-codes-docs
Draft

docs: document error codes and remove docs typecheck import inference#1445
pranaygp wants to merge 7 commits intomainfrom
pgp/error-codes-docs

Conversation

@pranaygp
Copy link
Collaborator

@pranaygp pranaygp commented Mar 18, 2026

Summary

  • Document error codes (USER_ERROR, RUNTIME_ERROR) in the errors and retries guide, including programmatic access via WorkflowRunFailedError and CLI/OTEL availability
  • Remove import inference from docs typecheck — the import-inference.ts system was auto-adding imports to doc snippets before typechecking, which masked real issues (e.g., importing WorkflowRunFailedError from "workflow" when it's only exported from @workflow/errors). Doc snippets now typecheck exactly as users would copy-paste them.
  • Fix 24 doc snippets across 12 files that were missing explicit imports for getWritable, createWebhook, createHook, defineHook, getRun, sleep, RetryableError, Agent, LanguageModel, ModelMessage, etc.

Test plan

  • pnpm test:docs passes locally (268/268)
  • Docs Checks CI workflow passes
  • Verify docs render correctly on preview deployment

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Contributor

vercel bot commented Mar 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview, Comment, Open in v0 Mar 18, 2026 10:41pm
example-nextjs-workflow-webpack Ready Ready Preview, Comment, Open in v0 Mar 18, 2026 10:41pm
example-workflow Ready Ready Preview, Comment, Open in v0 Mar 18, 2026 10:41pm
workbench-astro-workflow Ready Ready Preview, Comment, Open in v0 Mar 18, 2026 10:41pm
workbench-express-workflow Ready Ready Preview, Comment, Open in v0 Mar 18, 2026 10:41pm
workbench-fastify-workflow Ready Ready Preview, Comment, Open in v0 Mar 18, 2026 10:41pm
workbench-hono-workflow Ready Ready Preview, Comment, Open in v0 Mar 18, 2026 10:41pm
workbench-nitro-workflow Ready Ready Preview, Comment, Open in v0 Mar 18, 2026 10:41pm
workbench-nuxt-workflow Ready Ready Preview, Comment, Open in v0 Mar 18, 2026 10:41pm
workbench-sveltekit-workflow Ready Ready Preview, Comment, Open in v0 Mar 18, 2026 10:41pm
workbench-vite-workflow Ready Ready Preview, Comment, Open in v0 Mar 18, 2026 10:41pm
workflow-docs Ready Ready Preview, Comment, Open in v0 Mar 18, 2026 10:41pm
workflow-nest Ready Ready Preview, Comment, Open in v0 Mar 18, 2026 10:41pm
workflow-swc-playground Ready Ready Preview, Comment, Open in v0 Mar 18, 2026 10:41pm

@changeset-bot
Copy link

changeset-bot bot commented Mar 18, 2026

⚠️ No Changeset found

Latest commit: 0dc2a30

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

🧪 E2E Test Results

Some tests failed

Summary

Passed Failed Skipped Total
❌ ▲ Vercel Production 749 9 67 825
✅ 💻 Local Development 782 0 118 900
✅ 📦 Local Production 782 0 118 900
✅ 🐘 Local Postgres 782 0 118 900
✅ 🪟 Windows 72 0 3 75
❌ 🌍 Community Worlds 118 56 15 189
✅ 📋 Other 132 0 18 150
Total 3417 65 457 3939

❌ Failed Tests

▲ Vercel Production (9 failed)

example (1 failed):

  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KM1HZHW3DZFARBDGH53456G7 | 🔍 observability

express (2 failed):

  • DurableAgent e2e multimodal tool results passes through LanguageModelV3ToolResultOutput from tools
  • outputStreamWorkflow | wrun_01KM1HTBE4T7TXQEASJ555X3RH | 🔍 observability

nextjs-turbopack (1 failed):

  • DurableAgent e2e experimental_onStart (GAP) completes but callbacks are not called (GAP)

nextjs-webpack (1 failed):

  • DurableAgent e2e experimental_onToolCallStart (GAP) completes but callbacks are not called (GAP)

nitro (1 failed):

nuxt (2 failed):

  • DurableAgent e2e multimodal tool results passes through LanguageModelV3ToolResultOutput from tools
  • outputStreamWorkflow | wrun_01KM1HTBE4T7TXQEASJ555X3RH | 🔍 observability

vite (1 failed):

  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KM1HTS5821HX34ZQ6RY0GD7N | 🔍 observability
🌍 Community Worlds (56 failed)

mongodb (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KM1HS7N5SP6PEJE4S8YQJSQD
  • webhookWorkflow | wrun_01KM1HSGB8HXPSBEMHTKXYCHBN
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KM1J05YJSJPY95X0K3FTMYJD

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KM1HS7N5SP6PEJE4S8YQJSQD
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KM1J05YJSJPY95X0K3FTMYJD

turso (51 failed):

  • addTenWorkflow | wrun_01KM1HR4PANYTC8Q20HGSDZDJ7
  • addTenWorkflow | wrun_01KM1HR4PANYTC8Q20HGSDZDJ7
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KM1HS35TT4G8N40TX8C65N4T
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KM1HRB2MXS93MXZP7CXAK6FZ
  • promiseRaceWorkflow | wrun_01KM1HRGHCC89WBW8VH50WPTED
  • promiseAnyWorkflow | wrun_01KM1HRJHK60PKCD7ZC7CM6VSD
  • importedStepOnlyWorkflow | wrun_01KM1HSFWQKGVC5HSP7M8RG0MP
  • hookWorkflow | wrun_01KM1HRYBV6RSCTNQPGG1816G1
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KM1HS7N5SP6PEJE4S8YQJSQD
  • webhookWorkflow | wrun_01KM1HSGB8HXPSBEMHTKXYCHBN
  • sleepingWorkflow | wrun_01KM1HSPGJ9AZAV6STG1V0Y6Y5
  • parallelSleepWorkflow | wrun_01KM1HT2Z89WZDFSVMVFPD0SKE
  • nullByteWorkflow | wrun_01KM1HT790VE9D4QSRJVVRPK7G
  • workflowAndStepMetadataWorkflow | wrun_01KM1HT9CFTMGC8NVP7J88NAEH
  • fetchWorkflow | wrun_01KM1HWM95JWRS2HB5D8NVMFND
  • promiseRaceStressTestWorkflow | wrun_01KM1HWQETTPJRE47TCY1NQKC3
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KM1HZHW3DZFARBDGH53456G7
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KM1J05YJSJPY95X0K3FTMYJD
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KM1J0WPF24TD3VYD8ZHB6CXE
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KM1J1K7SF2BJ5XGFQP3SAMTT
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KM1J1VX89EM08E6G46XYN9YT
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KM1J215V4606MK97VQ2KM920
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KM1J23Y1YKSWWYT0HQ6BRHVC
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KM1J2JTSFHYS7THWRY4CRVMK
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KM1J2R2CV99AFNEFSS92PGYD
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KM1J2YFV51M131KW9NXSVNP9
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KM1J34W7DMXYRM949Q6P4V5E
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KM1J3B7XTWTYBM5F1FZR3ZN9
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KM1J3JXG38G86NJNWMRPD4PT
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KM1J3SGCCM9AK26F8GD6G53X
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KM1J4430K14M84YN2KAYY4PC
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KM1J4BHSS6R9NE5T833AMYH2
  • cancelRun - cancelling a running workflow | wrun_01KM1J4J0H46APZD2TGHEH89EW
  • cancelRun via CLI - cancelling a running workflow | wrun_01KM1J4V9KBQCVX0ZS0AP10XJ7
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KM1J57EDBVA9T54VYFF8R5DD
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KM1J5V08NCRSHT7QS9GS50JE
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KM1J65BA3RGM7A5GF5Q8HZTS

Details by Category

❌ ▲ Vercel Production
App Passed Failed Skipped
✅ astro 68 0 7
❌ example 67 1 7
❌ express 66 2 7
✅ fastify 68 0 7
✅ hono 68 0 7
❌ nextjs-turbopack 72 1 2
❌ nextjs-webpack 72 1 2
❌ nitro 67 1 7
❌ nuxt 66 2 7
✅ sveltekit 68 0 7
❌ vite 67 1 7
✅ 💻 Local Development
App Passed Failed Skipped
✅ astro-stable 66 0 9
✅ express-stable 66 0 9
✅ fastify-stable 66 0 9
✅ hono-stable 66 0 9
✅ nextjs-turbopack-canary 55 0 20
✅ nextjs-turbopack-stable 72 0 3
✅ nextjs-webpack-canary 55 0 20
✅ nextjs-webpack-stable 72 0 3
✅ nitro-stable 66 0 9
✅ nuxt-stable 66 0 9
✅ sveltekit-stable 66 0 9
✅ vite-stable 66 0 9
✅ 📦 Local Production
App Passed Failed Skipped
✅ astro-stable 66 0 9
✅ express-stable 66 0 9
✅ fastify-stable 66 0 9
✅ hono-stable 66 0 9
✅ nextjs-turbopack-canary 55 0 20
✅ nextjs-turbopack-stable 72 0 3
✅ nextjs-webpack-canary 55 0 20
✅ nextjs-webpack-stable 72 0 3
✅ nitro-stable 66 0 9
✅ nuxt-stable 66 0 9
✅ sveltekit-stable 66 0 9
✅ vite-stable 66 0 9
✅ 🐘 Local Postgres
App Passed Failed Skipped
✅ astro-stable 66 0 9
✅ express-stable 66 0 9
✅ fastify-stable 66 0 9
✅ hono-stable 66 0 9
✅ nextjs-turbopack-canary 55 0 20
✅ nextjs-turbopack-stable 72 0 3
✅ nextjs-webpack-canary 55 0 20
✅ nextjs-webpack-stable 72 0 3
✅ nitro-stable 66 0 9
✅ nuxt-stable 66 0 9
✅ sveltekit-stable 66 0 9
✅ vite-stable 66 0 9
✅ 🪟 Windows
App Passed Failed Skipped
✅ nextjs-turbopack 72 0 3
❌ 🌍 Community Worlds
App Passed Failed Skipped
✅ mongodb-dev 3 0 2
❌ mongodb 52 3 3
✅ redis-dev 3 0 2
❌ redis 53 2 3
✅ turso-dev 3 0 2
❌ turso 4 51 3
✅ 📋 Other
App Passed Failed Skipped
✅ e2e-local-dev-nest-stable 66 0 9
✅ e2e-local-prod-nest-stable 66 0 9

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: failure
  • Local Dev: success
  • Local Prod: success
  • Local Postgres: cancelled
  • Windows: success

Check the workflow run for details.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Express 0.043s (+9.3% 🔺) 1.005s (~) 0.962s 10 1.00x
💻 Local Nitro 0.043s (+0.7%) 1.005s (~) 0.962s 10 1.00x
🐘 Postgres Express 0.059s (-5.6% 🟢) 1.012s (~) 0.954s 10 1.35x
🐘 Postgres Nitro 0.075s (+18.3% 🔺) 1.015s (~) 0.940s 10 1.73x
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 0.432s (-6.1% 🟢) 2.222s (+5.1% 🔺) 1.789s 10 1.00x
▲ Vercel Express 0.476s (-13.3% 🟢) 2.459s (+5.9% 🔺) 1.983s 10 1.10x
▲ Vercel Next.js (Turbopack) 0.537s (-27.3% 🟢) 2.607s (-4.4%) 2.070s 10 1.24x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Nitro 1.126s (~) 2.007s (~) 0.880s 10 1.00x
💻 Local Express 1.129s (+2.7%) 2.006s (~) 0.878s 10 1.00x
🐘 Postgres Nitro 1.148s (~) 2.012s (~) 0.864s 10 1.02x
🐘 Postgres Express 1.151s (~) 2.012s (~) 0.862s 10 1.02x
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 2.010s (-2.0%) 3.236s (+0.6%) 1.226s 10 1.00x
▲ Vercel Next.js (Turbopack) 2.072s (-3.7%) 3.926s (+3.8%) 1.854s 10 1.03x
▲ Vercel Express 2.139s (+1.3%) 4.016s (+9.1% 🔺) 1.877s 10 1.06x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

workflow with 10 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Nitro 10.899s (~) 11.023s (~) 0.124s 3 1.00x
💻 Local Express 10.903s (+2.3%) 11.025s (~) 0.122s 3 1.00x
🐘 Postgres Nitro 10.941s (~) 11.039s (~) 0.098s 3 1.00x
🐘 Postgres Express 10.951s (~) 11.041s (~) 0.090s 3 1.00x
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 16.755s (-3.1%) 18.923s (+0.8%) 2.168s 2 1.00x
▲ Vercel Nitro 16.760s (-5.1% 🟢) 18.477s (~) 1.717s 2 1.00x
▲ Vercel Next.js (Turbopack) 20.678s (+21.8% 🔺) 22.050s (+17.8% 🔺) 1.371s 2 1.23x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 25 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 27.202s (~) 28.063s (~) 0.860s 3 1.00x
🐘 Postgres Express 27.219s (~) 28.067s (~) 0.849s 3 1.00x
💻 Local Express 27.491s (+2.5%) 28.052s (+3.7%) 0.561s 3 1.01x
💻 Local Nitro 27.508s (~) 28.053s (~) 0.545s 3 1.01x
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 44.301s (-1.1%) 45.648s (-1.3%) 1.347s 2 1.00x
▲ Vercel Nitro 47.676s (+5.8% 🔺) 48.996s (+5.7% 🔺) 1.320s 2 1.08x
▲ Vercel Next.js (Turbopack) 51.839s (+15.2% 🔺) 52.961s (+11.7% 🔺) 1.122s 2 1.17x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 50 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 54.308s (~) 55.094s (~) 0.786s 2 1.00x
🐘 Postgres Express 54.459s (~) 55.102s (~) 0.644s 2 1.00x
💻 Local Nitro 56.545s (~) 57.102s (~) 0.557s 2 1.04x
💻 Local Express 56.628s (+3.0%) 57.105s (+3.6%) 0.477s 2 1.04x
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 118.472s (+23.2% 🔺) 120.387s (+23.5% 🔺) 1.915s 1 1.00x
▲ Vercel Next.js (Turbopack) 122.415s (+28.7% 🔺) 123.706s (+27.4% 🔺) 1.291s 1 1.03x
▲ Vercel Nitro 148.111s (+42.2% 🔺) 148.971s (+41.5% 🔺) 0.860s 1 1.25x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.all with 10 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 1.273s (~) 2.011s (~) 0.738s 15 1.00x
🐘 Postgres Express 1.291s (+1.0%) 2.011s (~) 0.720s 15 1.01x
💻 Local Nitro 1.513s (-0.7%) 2.005s (~) 0.492s 15 1.19x
💻 Local Express 1.549s (+6.3% 🔺) 2.005s (~) 0.457s 15 1.22x
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Next.js (Turbopack) 4.325s (+76.9% 🔺) 6.436s (+60.7% 🔺) 2.112s 5 1.00x
▲ Vercel Express 6.394s (+166.9% 🔺) 7.761s (+106.3% 🔺) 1.366s 4 1.48x
▲ Vercel Nitro 10.582s (+335.5% 🔺) 12.797s (+282.5% 🔺) 2.215s 3 2.45x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.all with 25 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 2.445s (~) 3.013s (~) 0.568s 10 1.00x
🐘 Postgres Nitro 2.467s (~) 3.013s (~) 0.545s 10 1.01x
💻 Local Nitro 2.890s (+0.7%) 3.341s (+11.1% 🔺) 0.451s 9 1.18x
💻 Local Express 2.912s (+11.9% 🔺) 3.108s (+3.3%) 0.196s 10 1.19x
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Next.js (Turbopack) 5.223s (+106.9% 🔺) 6.898s (+72.0% 🔺) 1.674s 5 1.00x
▲ Vercel Express 12.292s (+415.8% 🔺) 13.296s (+242.8% 🔺) 1.004s 3 2.35x
▲ Vercel Nitro 13.316s (+395.5% 🔺) 14.671s (+304.4% 🔺) 1.355s 3 2.55x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 3.605s (~) 4.015s (~) 0.410s 8 1.00x
🐘 Postgres Express 3.652s (+1.4%) 4.014s (~) 0.362s 8 1.01x
💻 Local Nitro 8.030s (-0.8%) 8.769s (-2.8%) 0.739s 4 2.23x
💻 Local Express 8.184s (+20.5% 🔺) 9.021s (+28.6% 🔺) 0.836s 4 2.27x
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 4.646s (+71.7% 🔺) 6.279s (+61.1% 🔺) 1.633s 5 1.00x
▲ Vercel Next.js (Turbopack) 7.352s (+138.3% 🔺) 10.299s (+119.7% 🔺) 2.947s 3 1.58x
▲ Vercel Express 12.643s (+142.8% 🔺) 15.041s (+124.8% 🔺) 2.398s 2 2.72x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 10 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 1.286s (+0.8%) 2.011s (~) 0.725s 15 1.00x
🐘 Postgres Nitro 1.292s (+1.5%) 2.011s (~) 0.719s 15 1.00x
💻 Local Nitro 1.498s (-2.3%) 2.005s (~) 0.507s 15 1.16x
💻 Local Express 1.503s (+2.8%) 2.006s (~) 0.502s 15 1.17x
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 2.682s (+17.9% 🔺) 4.144s (+9.4% 🔺) 1.461s 8 1.00x
▲ Vercel Next.js (Turbopack) 6.342s (+172.4% 🔺) 8.660s (+128.2% 🔺) 2.318s 4 2.36x
▲ Vercel Nitro 9.784s (+263.2% 🔺) 11.084s (+179.1% 🔺) 1.301s 3 3.65x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.race with 25 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 2.449s (~) 3.012s (~) 0.563s 10 1.00x
🐘 Postgres Nitro 2.452s (~) 3.011s (~) 0.559s 10 1.00x
💻 Local Express 2.901s (+4.7%) 3.454s (+11.2% 🔺) 0.553s 9 1.18x
💻 Local Nitro 3.015s (+1.5%) 3.567s (+3.3%) 0.552s 9 1.23x
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Next.js (Turbopack) 9.025s (+205.4% 🔺) 10.573s (+144.2% 🔺) 1.548s 3 1.00x
▲ Vercel Nitro 10.080s (+293.3% 🔺) 11.235s (+210.4% 🔺) 1.155s 3 1.12x
▲ Vercel Express 16.385s (+609.6% 🔺) 19.203s (+424.2% 🔺) 2.818s 3 1.82x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Promise.race with 50 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 3.587s (~) 4.015s (~) 0.428s 8 1.00x
🐘 Postgres Nitro 3.607s (~) 4.013s (~) 0.406s 8 1.01x
💻 Local Nitro 8.938s (+4.3%) 9.522s (+5.5% 🔺) 0.584s 4 2.49x
💻 Local Express 9.329s (+28.7% 🔺) 10.028s (+29.1% 🔺) 0.699s 3 2.60x
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 7.832s (+196.3% 🔺) 10.246s (+172.3% 🔺) 2.414s 3 1.00x
▲ Vercel Nitro 11.936s (+224.4% 🔺) 14.506s (+197.0% 🔺) 2.570s 3 1.52x
▲ Vercel Next.js (Turbopack) 17.826s (+454.2% 🔺) 19.642s (+325.0% 🔺) 1.816s 3 2.28x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Stream Benchmarks (includes TTFB metrics)
workflow with stream

💻 Local Development

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Express 0.201s (+45.4% 🔺) 1.003s (~) 0.012s (+11.5% 🔺) 1.018s (~) 0.817s 10 1.00x
💻 Local Nitro 0.202s (+2.8%) 1.003s (~) 0.011s (-1.7%) 1.017s (~) 0.815s 10 1.00x
🐘 Postgres Express 0.220s (-0.6%) 0.999s (+0.6%) 0.001s (-12.5% 🟢) 1.014s (~) 0.794s 10 1.09x
🐘 Postgres Nitro 0.224s (+2.8%) 0.995s (~) 0.001s (-13.3% 🟢) 1.013s (~) 0.788s 10 1.11x
💻 Local Next.js (Turbopack) ⚠️ missing - - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - - -

▲ Production (Vercel)

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Next.js (Turbopack) 3.364s (+109.4% 🔺) 3.522s (+37.7% 🔺) 0.004s (-79.9% 🟢) 4.842s (+54.8% 🔺) 1.478s 10 1.00x
▲ Vercel Nitro 3.527s (+117.4% 🔺) 3.822s (+58.9% 🔺) 0.004s (-12.0% 🟢) 29.092s (+95.2% 🔺) 25.565s 10 1.05x
▲ Vercel Express 4.158s (+156.7% 🔺) 4.897s (+76.3% 🔺) 0.004s (-2.2%) 5.708s (+71.2% 🔺) 1.550s 10 1.24x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World 🥇 Fastest Framework Wins
💻 Local Nitro 8/12
🐘 Postgres Express 6/12
▲ Vercel Express 5/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework 🥇 Fastest World Wins
Express 🐘 Postgres 8/12
Next.js (Turbopack) ▲ Vercel 12/12
Nitro 🐘 Postgres 8/12
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
@pranaygp pranaygp requested a review from VaguelySerious March 18, 2026 19:46
@pranaygp pranaygp marked this pull request as ready for review March 18, 2026 19:46
@pranaygp pranaygp requested a review from a team as a code owner March 18, 2026 19:46
Copilot AI review requested due to automatic review settings March 18, 2026 19:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the “Errors & Retrying” documentation to explain the new run failure error codes (USER_ERROR, RUNTIME_ERROR) and how to read them from WorkflowRunFailedError.cause.code, aligning the docs with the companion runtime change in #1340.

Changes:

  • Add an “Error Codes” section with a programmatic example and a code/meaning table.
  • Add a callout noting where else the error code is surfaced (CLI + OTEL).
  • Add a Changesets entry (currently empty/invalid).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
docs/content/docs/foundations/errors-and-retries.mdx Documents USER_ERROR/RUNTIME_ERROR and shows how to access err.cause.code.
.changeset/error-codes-docs.md Adds a changeset file (currently missing required contents).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

| `RUNTIME_ERROR` | An internal runtime error such as a corrupted event log or missing data. If you see this, please [file an issue](https://github.com/vercel/workflow/issues) |

<Callout type="info">
The error code is also available on the run entity via the CLI (`workflow inspect runs <runId> --withData`) in the `error.code` field, and as an OTEL span attribute (`workflow.error.code`) for observability.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — removed --withData and switched to npx workflow to match the rest of the docs.

Comment on lines +1 to +2
---
---
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no changes needed for docs change

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the empty changeset — this is a docs-only change so no changeset is needed.

When a workflow run fails, the error includes a `code` that classifies the failure. You can access it programmatically via the `Run` class:

```typescript lineNumbers
import { WorkflowRunFailedError } from "workflow";
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — added import { start } from "workflow/api" to match other docs.

Comment on lines +144 to +156
When a workflow run fails, the error includes a `code` that classifies the failure. You can access it programmatically via the `Run` class:

```typescript lineNumbers
import { WorkflowRunFailedError } from "workflow";

const run = await start(myWorkflow, [input]);

try {
const result = await run.returnValue;
} catch (err) {
if (WorkflowRunFailedError.is(err)) {
console.log(err.cause.code); // "USER_ERROR" or "RUNTIME_ERROR"
console.log(err.cause.message); // The error message
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call — updated wording to "may include" and changed the inline comment to show undefined as a possible value.

@pranaygp pranaygp enabled auto-merge (squash) March 18, 2026 19:54
- Add missing `start` import from `workflow/api`
- Note that `cause.code` may be undefined for older runs
- Remove invalid `--withData` flag and use `npx workflow` CLI style
- Remove empty changeset (docs-only change needs no changeset)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove the import-inference system that auto-added imports to doc
snippets before typechecking. This was masking real issues — if a
snippet imported from the wrong module or was missing an import, the
typechecker silently fixed it instead of catching the bug.

All 24 affected doc snippets now have explicit, correct imports that
match what users would actually write.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@pranaygp pranaygp marked this pull request as draft March 18, 2026 22:34
auto-merge was automatically disabled March 18, 2026 22:34

Pull request was converted to draft

@pranaygp pranaygp changed the title docs: document error codes in errors and retries guide docs: document error codes and remove docs typecheck import inference Mar 18, 2026
When hitting API rate limits, use `RetryableError` with a delay:

```typescript lineNumbers
import { sleep, RetryableError } from "workflow";
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this example is not using sleep

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — removed the unused sleep import. This snippet only uses RetryableError.

@@ -74,6 +78,7 @@ export async function processPayment() {
When a hook conflict occurs, awaiting the hook will throw a `WorkflowRuntimeError`. You can catch this error to handle the conflict gracefully:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this correct? is it not a HookConflictError? is it really just a WorkflowRuntimeError? 🤔

WorkflowRuntimeError is meant to be only for infrastructure outages/issues with an invalid workflow log - not normal behavior

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right to question this. I checked the runtime code — suspension-handler.ts:342 confirms it currently rejects with WorkflowRuntimeError when a hook_conflict event is replayed. So the docs are accurate to the current behavior, but this does seem like it should be a more specific error type (e.g. HookConflictError) since WorkflowRuntimeError is meant for infrastructure issues. Want me to leave this as-is for now since it's a pre-existing doc, or file an issue for the error type change?

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants