Error Codes

Every user-facing B4.run failure carries a stable B4_Exxxx code. You'll see the code wherever the failure shows up (CLI stderr, HTTP/SSE error bodies and permission-denial tool results), so you can search for it and link to it.

Codes are grouped by range: E1xxx config / b4 check, E2xxx sandbox, E3xxx permissions, E4xxx model / provider, and E5xxx runtime / import. A code without a docs link is still a stable identifier you can search for.

CodeMeaningDocs
B4_E1001Invalid tool scope/docs/tools#scoping-a-routes-tools
B4_E1002Invalid sandbox config/docs/configuration#sandbox
B4_E1003Unknown build target/docs/deployment
B4_E1004Invalid delegation policy/docs/subagents#delegation-policy
B4_E1005Feature unsupported by the build target or runtime/docs/deployment
B4_E1006App root package.json is not an ES module/docs/cli#b4-check
B4_E1007Route entry has no recognisable export/docs/cli#b4-check
B4_E1008Route entry exports more than one route kind/docs/cli#b4-check
B4_E1009Invalid memory config/docs/configuration#memory
B4_E1010Invalid agentsMd config/docs/configuration#agentsmd
B4_E2001Sandbox unavailable/docs/sandbox#what-it-is--and-isnt
B4_E2002Sandbox preflight failed/docs/sandbox#quickstart
B4_E3001Permission denied/docs/permissions
B4_E3002Subagent dispatch denied/docs/subagents#delegation-policy
B4_E3003Thread access policy failed to load/docs/thread-access#load-failures
B4_E3004Middleware failed to load/docs/middleware#when-middleware-fails-to-load
B4_E4001Model provider package missing/docs/agents#model-providers
B4_E4002Unknown model id/docs/agents#model-providers
B4_E5001Import or export mismatchNone
B4_E5002Tool file has the wrong shape/docs/tools
B4_E5003Subagent unavailable or dispatch failed/docs/subagents#dispatch-failures
B4_E5101Node version below the supported floorNone
B4_E5201Inspector server failed/docs/inspector
B4_E5301Runtime store not provided/docs/deployment
B4_E5401Invalid AG-UI run envelope/docs/ag-ui#envelope-validation
B4_E5402AG-UI response schema rejected/docs/ag-ui#response-schema