Skip to content

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

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

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 758 0 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 198 0 27 225
Total 3492 56 466 4014

❌ Failed Tests

🌍 Community Worlds (56 failed)

mongodb (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KM1SEB801EQP4YF8PEXP7VWF
  • webhookWorkflow | wrun_01KM1SEKZTZ6WR1JQF2F0PBTCJ
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KM1SKRXT4Y3V9VC7YYA4Q9Y3

redis (2 failed):

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

turso (51 failed):

  • addTenWorkflow | wrun_01KM1SD7GKQ8BE9Z0YBJJCPZ19
  • addTenWorkflow | wrun_01KM1SD7GKQ8BE9Z0YBJJCPZ19
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KM1SDMEDA0X1Y8BZNFT1BV38
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KM1SDE648CFKF21NX33ME2BZ
  • promiseRaceWorkflow | wrun_01KM1SDK0ZYB0J992Z0JXQSPJQ
  • promiseAnyWorkflow | wrun_01KM1SDN70EFZ4BD30TVQ8Q1K2
  • importedStepOnlyWorkflow | wrun_01KM1SDYB5Z5W2KFFS25CXE9SE
  • hookWorkflow | wrun_01KM1SE1DJ6FJ76X353B0952GW
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KM1SEB801EQP4YF8PEXP7VWF
  • webhookWorkflow | wrun_01KM1SEKZTZ6WR1JQF2F0PBTCJ
  • sleepingWorkflow | wrun_01KM1SET7S0R2S111R2JTY7QX7
  • parallelSleepWorkflow | wrun_01KM1SF5YX6H8AHKM2SHEN2YV5
  • nullByteWorkflow | wrun_01KM1SF9AS9NYKV7TTAQ6X25C5
  • workflowAndStepMetadataWorkflow | wrun_01KM1SFBJ6JSXS3DE8Z5RJD385
  • fetchWorkflow | wrun_01KM1SG5F92W4YS9NP8XN1SF98
  • promiseRaceStressTestWorkflow | wrun_01KM1SG8WR880Q8J00FBYPJKRW
  • 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_01KM1SK4JY94XYTXW5TPDAF0BM
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KM1SKRXT4Y3V9VC7YYA4Q9Y3
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KM1SME530KT90VK9TJD7CAX5
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KM1SN20X08FCBPN1YF883QK6
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KM1SNB3RE7SNN5TQNHNVFDST
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KM1SNGMQH3AY18JT18W97Y0R
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KM1SNJVG3SMRWWKBPP63RKGE
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KM1SP75A58WNJ5TBQZ1N7E05
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KM1SPCYQV6HCGFJ36XXX7FZT
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KM1SPJF1GRB31RBYPGRXC2WA
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KM1SPS7VA7737PMK9SMVFH8T
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KM1SQ012BJKAT1332T4W5GE9
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KM1SQ6R5BPR9PDASRZPMPGRV
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KM1SQENXNY97WX03TEP8CDQ3
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KM1SQSNCY5STA8A3WM3C4047
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KM1SR1X2JFW6GAV583FTJRTV
  • cancelRun - cancelling a running workflow | wrun_01KM1SR8NEJEXG5FJE0M0MZCR5
  • cancelRun via CLI - cancelling a running workflow | wrun_01KM1SRJ579RV2HSW63VVFFZYZ
  • 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_01KM1SRYDR6M7X76CVWGWJ4511
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KM1SSJQAY7ARFK7B8D35YWVS
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KM1SSYAPGAVWTDTE1QBT0M3T

Details by Category

✅ ▲ Vercel Production
App Passed Failed Skipped
✅ astro 68 0 7
✅ example 68 0 7
✅ express 68 0 7
✅ fastify 68 0 7
✅ hono 68 0 7
✅ nextjs-turbopack 73 0 2
✅ nextjs-webpack 73 0 2
✅ nitro 68 0 7
✅ nuxt 68 0 7
✅ sveltekit 68 0 7
✅ vite 68 0 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-postgres-nest-stable 66 0 9
✅ e2e-local-prod-nest-stable 66 0 9

📋 View full workflow run

@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 🥇 Nitro 0.043s (+0.9%) 1.005s (~) 0.962s 10 1.00x
🐘 Postgres Express 0.049s (-20.3% 🟢) 1.011s (~) 0.962s 10 1.14x
💻 Local Express 0.054s (+37.6% 🔺) 1.005s (~) 0.950s 10 1.26x
🐘 Postgres Nitro 0.061s (-4.3%) 1.011s (~) 0.950s 10 1.40x
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 0.465s (-15.4% 🟢) 2.194s (-5.5% 🟢) 1.729s 10 1.00x
▲ Vercel Next.js (Turbopack) 0.497s (-32.6% 🟢) 2.430s (-10.9% 🟢) 1.933s 10 1.07x
▲ Vercel Nitro 0.509s (+10.6% 🔺) 2.324s (+9.9% 🔺) 1.815s 10 1.10x

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

workflow with 1 step

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Express 1.125s (+2.4%) 2.006s (~) 0.881s 10 1.00x
🐘 Postgres Express 1.130s (-1.4%) 2.021s (~) 0.891s 10 1.00x
💻 Local Nitro 1.134s (~) 2.006s (~) 0.872s 10 1.01x
🐘 Postgres Nitro 1.162s (+0.9%) 2.012s (~) 0.850s 10 1.03x
💻 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.028s (-4.0%) 3.367s (-8.5% 🟢) 1.339s 10 1.00x
▲ Vercel Next.js (Turbopack) 2.036s (-5.3% 🟢) 3.559s (-6.0% 🟢) 1.522s 10 1.00x
▲ Vercel Nitro 2.204s (+7.4% 🔺) 3.704s (+15.2% 🔺) 1.501s 10 1.09x

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

workflow with 10 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 10.745s (-1.8%) 11.039s (~) 0.294s 3 1.00x
💻 Local Nitro 10.896s (~) 11.022s (~) 0.126s 3 1.01x
💻 Local Express 10.909s (+2.4%) 11.023s (~) 0.114s 3 1.02x
🐘 Postgres Nitro 11.020s (+0.6%) 11.376s (+3.0%) 0.356s 3 1.03x
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 16.177s (-8.4% 🟢) 18.047s (-2.5%) 1.869s 2 1.00x
▲ Vercel Express 16.473s (-4.8%) 17.899s (-4.7%) 1.426s 2 1.02x
▲ Vercel Next.js (Turbopack) 16.945s (~) 18.716s (~) 1.770s 2 1.05x

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

workflow with 25 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 26.751s (-1.7%) 27.063s (-3.6%) 0.312s 3 1.00x
🐘 Postgres Nitro 27.279s (~) 28.070s (~) 0.791s 3 1.02x
💻 Local Express 27.475s (+2.5%) 28.053s (+3.7%) 0.578s 3 1.03x
💻 Local Nitro 27.479s (~) 28.052s (~) 0.574s 3 1.03x
💻 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.032s (-1.7%) 45.111s (-2.5%) 1.080s 2 1.00x
▲ Vercel Next.js (Turbopack) 44.084s (-2.1%) 45.576s (-3.9%) 1.492s 2 1.00x
▲ Vercel Nitro 46.282s (+2.7%) 47.700s (+2.9%) 1.418s 2 1.05x

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

workflow with 50 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 53.494s (-1.5%) 54.096s (-1.8%) 0.602s 2 1.00x
🐘 Postgres Nitro 54.523s (~) 55.100s (~) 0.577s 2 1.02x
💻 Local Nitro 56.545s (~) 57.099s (~) 0.554s 2 1.06x
💻 Local Express 56.669s (+3.0%) 57.105s (+3.6%) 0.436s 2 1.06x
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 93.506s (-10.2% 🟢) 94.821s (-9.9% 🟢) 1.315s 1 1.00x
▲ Vercel Express 94.257s (-2.0%) 95.859s (-1.7%) 1.602s 1 1.01x
▲ Vercel Next.js (Turbopack) 95.286s (~) 97.289s (~) 2.003s 1 1.02x

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

Promise.all with 10 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 1.219s (-4.7%) 2.012s (~) 0.793s 15 1.00x
🐘 Postgres Nitro 1.285s (+0.6%) 2.011s (~) 0.726s 15 1.05x
💻 Local Express 1.499s (+2.9%) 2.005s (~) 0.506s 15 1.23x
💻 Local Nitro 1.518s (~) 2.005s (~) 0.487s 15 1.25x
💻 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) 2.305s (-5.7% 🟢) 3.585s (-10.5% 🟢) 1.279s 9 1.00x
▲ Vercel Nitro 2.410s (-0.8%) 3.889s (+16.2% 🔺) 1.479s 8 1.05x
▲ Vercel Express 2.731s (+14.0% 🔺) 4.095s (+8.8% 🔺) 1.364s 8 1.18x

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

Promise.all with 25 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 2.370s (-3.4%) 3.012s (~) 0.642s 10 1.00x
🐘 Postgres Nitro 2.460s (~) 3.013s (~) 0.553s 10 1.04x
💻 Local Express 2.873s (+10.4% 🔺) 3.007s (~) 0.133s 10 1.21x
💻 Local Nitro 2.882s (~) 3.209s (+6.7% 🔺) 0.326s 10 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 🥇 Nitro 2.564s (-4.6%) 3.914s (+7.9% 🔺) 1.351s 8 1.00x
▲ Vercel Next.js (Turbopack) 2.857s (+13.1% 🔺) 4.126s (+2.9%) 1.269s 8 1.11x
▲ Vercel Express 3.004s (+26.1% 🔺) 3.978s (+2.6%) 0.974s 8 1.17x

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

Promise.all with 50 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 3.525s (-2.1%) 4.014s (~) 0.490s 8 1.00x
🐘 Postgres Nitro 3.627s (~) 4.013s (~) 0.386s 8 1.03x
💻 Local Nitro 7.905s (-2.4%) 8.267s (-8.4% 🟢) 0.362s 4 2.24x
💻 Local Express 8.188s (+20.6% 🔺) 9.019s (+28.6% 🔺) 0.831s 4 2.32x
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 3.277s (-37.1% 🟢) 4.503s (-32.7% 🟢) 1.226s 7 1.00x
▲ Vercel Nitro 3.649s (+34.8% 🔺) 5.039s (+29.3% 🔺) 1.389s 6 1.11x
▲ Vercel Next.js (Turbopack) 3.682s (+19.4% 🔺) 5.161s (+10.1% 🔺) 1.479s 6 1.12x

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

Promise.race with 10 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 1.226s (-3.9%) 2.011s (~) 0.785s 15 1.00x
🐘 Postgres Nitro 1.280s (+0.6%) 2.012s (~) 0.732s 15 1.04x
💻 Local Nitro 1.534s (~) 2.006s (~) 0.472s 15 1.25x
💻 Local Express 1.553s (+6.1% 🔺) 2.005s (~) 0.453s 15 1.27x
💻 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) 2.287s (-1.8%) 3.745s (-1.3%) 1.459s 9 1.00x
▲ Vercel Express 2.401s (+5.5% 🔺) 3.650s (-3.7%) 1.249s 9 1.05x
▲ Vercel Nitro 2.751s (+2.1%) 4.049s (+2.0%) 1.298s 8 1.20x

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

Promise.race with 25 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 2.383s (-2.9%) 3.012s (~) 0.630s 10 1.00x
🐘 Postgres Nitro 2.473s (+1.0%) 3.012s (~) 0.539s 10 1.04x
💻 Local Nitro 2.904s (-2.3%) 3.567s (+3.3%) 0.663s 9 1.22x
💻 Local Express 2.989s (+7.9% 🔺) 3.759s (+21.0% 🔺) 0.770s 8 1.25x
💻 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.855s (+23.7% 🔺) 4.295s (+17.2% 🔺) 1.440s 7 1.00x
▲ Vercel Next.js (Turbopack) 2.879s (-2.6%) 4.300s (-0.7%) 1.421s 8 1.01x
▲ Vercel Nitro 3.017s (+17.7% 🔺) 4.399s (+21.5% 🔺) 1.382s 7 1.06x

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

Promise.race with 50 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 3.564s (-0.8%) 4.015s (~) 0.451s 8 1.00x
🐘 Postgres Nitro 3.608s (~) 4.015s (~) 0.408s 8 1.01x
💻 Local Nitro 8.280s (-3.4%) 9.022s (~) 0.742s 4 2.32x
💻 Local Express 8.877s (+22.5% 🔺) 9.273s (+19.4% 🔺) 0.395s 4 2.49x
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 3.154s (+19.3% 🔺) 4.408s (+17.2% 🔺) 1.255s 7 1.00x
▲ Vercel Nitro 3.597s (-2.2%) 4.881s (~) 1.284s 7 1.14x
▲ Vercel Next.js (Turbopack) 4.108s (+27.7% 🔺) 6.082s (+31.6% 🔺) 1.975s 5 1.30x

🔍 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
🐘 Postgres 🥇 Express 0.176s (-20.2% 🟢) 1.000s (+0.7%) 0.001s (-18.8% 🟢) 1.014s (~) 0.838s 10 1.00x
💻 Local Express 0.198s (+42.9% 🔺) 1.003s (~) 0.011s (+8.7% 🔺) 1.017s (~) 0.820s 10 1.12x
💻 Local Nitro 0.199s (+1.5%) 1.003s (~) 0.011s (-7.8% 🟢) 1.017s (~) 0.818s 10 1.13x
🐘 Postgres Nitro 0.225s (+3.2%) 0.993s (-0.7%) 0.001s (-6.7% 🟢) 1.013s (~) 0.788s 10 1.28x
💻 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 🥇 Nitro 1.657s (+2.2%) 2.529s (+5.2% 🔺) 0.005s (-6.1% 🟢) 3.092s (-79.3% 🟢) 1.435s 10 1.00x
▲ Vercel Express 1.918s (+18.4% 🔺) 2.554s (-8.1% 🟢) 0.011s (+148.9% 🔺) 3.179s (-4.6%) 1.261s 10 1.16x
▲ Vercel Next.js (Turbopack) 2.676s (+66.6% 🔺) 3.766s (+47.3% 🔺) 0.011s (-44.7% 🟢) 4.339s (+38.7% 🔺) 1.663s 10 1.61x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

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

Winner determined by most benchmark wins

Framework 🥇 Fastest World Wins
Express 🐘 Postgres 9/12
Next.js (Turbopack) ▲ Vercel 12/12
Nitro 🐘 Postgres 7/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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm doing a follow up PR to fix this and throw an actual HookConflictError but out of scope for this PR

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

pranaygp commented Mar 19, 2026

test failures on vercel world are unrelated to docs changes 🤷🏼
let's review

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.

3 participants