Yolk SDK

Troubleshooting

Common setup, runtime, streaming, provider, MCP, sandbox, and workflow failures.

Use this page when a guide compiles but the app does not behave as expected.

Package and module errors

Cannot find an export

Check that all @yolk-sdk/* packages use the same canary version:

pnpm list '@yolk-sdk/*'

Yolk packages release in lockstep. Do not mix canary versions.

Also check that effect and the coordinated @effect/* runtime packages match the version the canary expects (pnpm list effect): canary.97 to canary.115 use effect@4.0.0, which removed the effect/unstable/* entrypoints, canary.116 to canary.123 use effect@4.0.5, canary.124 to canary.138 use effect@4.1.2, canary.139 to canary.154 use effect@4.1.4, canary.155 to canary.166 use effect@4.1.5, canary.167 to canary.177 use effect@4.1.7, and canary.178 and later require effect ~4.2.0 (tested on 4.2.0) as a peer dependency. Import from effect/http, effect/process, and the other effect/<area> paths; see Migration.

Node or ESM errors

Yolk packages are ESM-first and require Node 22 or newer. @yolk-sdk/codemode requires Node 22.19 or newer.

Use explicit public subpaths:

import { run } from '@yolk-sdk/agent/loop'
import { makeTool } from '@yolk-sdk/agent/tools'

Do not import package-internal src/* files from an app.

Effect layer errors

Missing service

Most runtime failures that mention a missing service mean an Effect layer was not provided.

Missing serviceProvide
LLMProvidermodel provider layer or FauxProvider.layer(...)
ToolExecutormakeToolExecutorLayer(toolSet) or host executor layer
LoopConfigLoopConfig.defaultLayer or custom loop config
ContextTransformerContextTransformer.identity or compaction layer
HttpClientFetchHttpClient.layer or host HTTP layer
ClassifierModelVercelAiGatewayClassifierLayer or a host classifier

Build one app-level layer and provide it at the route/runtime boundary.

Provider errors

Missing OpenAI provider environment configuration

OpenAiProviderLayer reads OPENAI_API_KEY and OPENAI_MAX_COMPLETION_TOKENS through Effect Config. The output limit must parse as an integer. If you do not want env config, use makeOpenAiProviderLayer({ apiKey, maxCompletionTokens }) and provide an HTTP layer.

Missing Vercel AI Gateway environment configuration

VercelAiGatewayProviderLayer reads AI_GATEWAY_API_KEY, falling back to VERCEL_OIDC_TOKEN, and requires integer AI_GATEWAY_MAX_COMPLETION_TOKENS. If you configure the layer explicitly, pass the selected credential as apiKey to makeVercelAiGatewayProviderLayer; model ids must use Gateway's opaque provider/model form.

VercelAiGatewayClassifierLayer reads only the credential (AI_GATEWAY_API_KEY, falling back to VERCEL_OIDC_TOKEN); it does not need AI_GATEWAY_MAX_COMPLETION_TOKENS. A missing credential fails with ClassificationProviderError (kind auth).

Diagnose provider failures with providerCode

Chat Completions and Responses HTTP failures copy the envelope string code (falling back to type) into LLMError.provider.providerCode, alongside status and kind. Codes may be absent, and raw upstream bodies stay out of typed failures: diagnose from providerCode, status, and kind rather than logging raw response bodies.

Claude subscription (anthropic_claude) HTTP and stream errors report the more specific error.details.error_code when present, then error.type, then error.code. Native Messages HTTP errors (OpenCode Go protocol: 'messages') follow the same rule, so an unknown model reports providerCode: 'not_found_error'.

Retryability follows the structured fields: a provider code that names a failure (for example rate_limit_error or overloaded_error), then the HTTP status (429, 408, 5xx, and 529 retry; other 4xx do not). Upstream message text only refines that, and request values the upstream echoes back, such as the model id, are ignored, so a model id containing "overload" never makes a 404 retryable. Stream error events (Chat Completions error envelopes, Responses error / response.failed, Claude and Messages error) carry no status, so their text decides when their code names no failure; the requested model id is removed from that text too, so it never makes an in-stream error retryable.

Claude rejects a model with claude_code_version_too_old

Anthropic gates newer models by the Claude Code version the Claude subscription transport reports. An HTTP 400 with providerCode: 'claude_code_version_too_old' means the installed @yolk-sdk/agent reports a version that model does not accept yet: upgrade to the latest canary, or pick an older model until a release supports it.

Diagnose chat stream failures with stream diagnostics

OpenAI-compatible chat streaming expects server-sent events. When a 2xx response declares an explicit non-SSE Content-Type (JSON or HTML), the provider fails before consuming the body with invalid_response and providerCode: 'unexpected_content_type' (non-retryable, safe numeric status attached). A missing Content-Type keeps the existing lenient SSE parsing.

Chat stream failures (unexpected_content_type, incomplete_stream, and streamed openAiChatResponseIssues parser rejections) carry optional provider.stream diagnostics (ProviderStreamDiagnostics) that survive provider sanitization and wire serialization:

FieldMeaning
protocolProvider wire protocol; these chat diagnostics report chat-completions
responseFormatCoarse declared content type (sse, json, other, unknown for no header)
receivedBytesBytes received from HTTP body chunks before text decoding
bufferedCharsUndelivered SSE tail characters, counted in UTF-16 code units
outputStartedWhether text or reasoning output was actually emitted to the consumer
terminalSeenWhether a terminal frame ([DONE] or a processed finish reason) was observed
invalidFieldOn invalid_stream_chunk: first rejected field path and its JSON received

invalidField.path uses the provider schema's own field names with [] for any array item (for example $.choices[].delta.tool_calls[].id), and received is the JSON type found there (missing, null, boolean, number, string, array, or object), never the value. The chat parser already reads null in every optional chunk field as absent (OpenAI-compatible hosts send "tool_calls": null or "id": null on continuation deltas), so an invalidField names a real shape mismatch. An omitted choices is accepted (usage-only chunks), but choices: null stays a rejection: it is not a chat chunk (often an error in another shape) and must not read as an empty one.

Diagnostics carry counters and milestones only: no transcript bytes, raw header values, or body fragments are retained. Streams that end without a terminal frame fail incomplete_stream (non-retryable) even when output already started, and the SDK never synthesizes success or a retry for a missing terminal.

Provider returned a tool call with an empty name

A model or endpoint sometimes returns a tool call whose id or name is empty or padded. Providers fail the request with a typed non-retryable LLMError (invalid_response); on Chat Completions it carries providerCode: 'invalid_tool_call'. The call never reaches your tools. Surface it like other provider failures: a host fallback model can retry the turn, and repeated failures point at the model or endpoint. See provider errors.

OAuth provider returns unauthorized

Codex, Claude, and Grok provider layers need a fresh OAuthAccessToken. Your host owns token storage, refresh, broker routes, account linking, and audit.

For Grok subscriptions, send the token to the default xAI CLI proxy, not api.x.ai. A custom responsesUrl must be a trusted proxy because it receives the bearer. Browser PKCE requires xAI's fixed loopback callback. The SDK exports device-flow constants but the host must implement initiation and polling when it cannot listen there. Coalesce concurrent refreshes and persist a rotated refresh token atomically. The provider rejects mismatched or expired access-token envelopes before HTTP. The CLI proxy is a private, unsupported surface that may change; use it only when permitted by xAI's terms.

Grok allowance returns HTTP 412

The private Grok billing endpoint may return 412 for team or organization principals without a personal team even while model requests still work. Treat the sanitized usage error as allowance unavailable; do not classify it as token expiry or expose the raw response body. The host owns any principal-specific fallback or UI message.

Media input rejected

Set model capabilities to match the provider/model. The loop rejects unsupported image, document, or audio parts before provider execution.

Capabilities do not resolve private sources or convert unsupported media. Codex/Claude reject unresolved image/document refs and audio tool results; their assistant text lowering still rejects media even after resolution. Resolve refs in a request-local copy inside each provider attempt, including overflow retry. See Resolve private attachments for retry composition and provider limitations.

For generic OpenAI chat, native PDF user-message parts require supportsPdfAttachments: true; Gateway enables them by default and accepts false to disable them. URL-backed PDFs are fetched and buffered by the host's HttpClient, not by Gateway. If fetch or read fails, verify the source URL is authorized and reachable through a bounded transport that controls redirects, credentials, byte limits, timeouts, and logs, or provide validated inline bytes instead. The SDK does not add those network guarantees.

Anthropic context is too long

Anthropic prompt-too-long responses become non-retryable context_overflow failures. Generic loop retry does not retry them. Compact before provider execution, or use makeContextOverflowRetryProvider to run your host compactor and retry once.

Claude reaches max_tokens

Claude output-limit stops fail as non-retryable invalid_response instead of normal completion. A stream may already have emitted partial text, but it will not emit normal Done. Increase maxTokens, request shorter output, or adjust host output policy before retrying.

Claude thinking ended without a signature

The Claude provider fails a turn as non-retryable invalid_response when a thinking block ends without the signature its replay needs (a max_tokens or content_filter stop is reported first). Anthropic always signs thinking, so look for a proxy that rewrites the stream.

Tool errors

Tool is not configured

The model called a tool name not present in the resolved tool set. Resolve tools server-side and pass the same toolSet.tools and toolSet.execute into the run.

Tool input validation failed

makeTool validates model input with Effect Schema. Return model-visible validation errors for recoverable cases. Keep thrown ToolErrors safe and non-secret.

Unknown keys are rejected at any depth, for example Unknown argument "x". Allowed arguments: a, b. Remove extra keys from callers, fixtures, and code mode scripts. A number or boolean the model sent as a JSON string is rejected with the string and the literal to send (Argument "offset" must be a JSON number, but it was the string "120": send 120 without quotes.); some models quote numbers inside union-shaped parameters. null on a Schema.optional(X) field is accepted as omitted, but required fields still reject it. Custom invalidParamsMessage callbacks can keep the hint with withToolArgumentsErrorHint(message, error) from @yolk-sdk/agent/tools.

In code mode, a call whose arguments JSON would change (NaN, invalid Dates, Map, class instances) rejects before it runs, for example tools.search: argument at limit is NaN; pass a finite number or omit the key.

Typed input is unavailable or stays pending

Pass toolSet.inputs from resolveTools alongside toolSet.tools into loop/runtime configuration and prepareToolBatch. Display-only ToolDef.input metadata cannot validate a response; omitted handlers produce unavailable results without prompting or executing.

Use makeInputTool to retain original call/response validators. input_validation_required means an input registration lacks required validation; input_unsupported_policy means it combines input with unsupported approval/background policy. Inputs collect data, not action authorization.

Invalid response data re-pends the same request without validation details in events. Keep the form open, correct the payload, and resubmit with the same opaque request/call ids. Do not project an optimistic accepted result; only the first valid submission or cancellation settles the request. See Collect typed input.

Action-backed interaction is unavailable or reappears

Pass interactionHost to resolveTools, then both toolSet.interactions and toolSet.interactionHost to loop/runtime configuration. Configuring only the executor does not let the loop load accepted receipts. Durable preflight must call loadInteractionReceipts and pass fresh interactionReceipts to prepareToolBatch; missing host wiring never grants execution.

The host must authenticate and atomically accept the response before SDK resume. Keep invalid submissions editable; local submission and InteractionSubmitted are not completion. Voice/realtime and background activation do not support these tools.

An unknown outcome means the action may have happened. Reconcile using the authoritative receipt and provider state; never automatically retry the action or overwrite its settled receipt. See Authorize one action.

Code mode tool resolution fails

resolveTools fails with ToolRegistryError before any tool runs when the exposure is invalid:

  • invalid_tool_exposure: a tool sets discovery without callableBy: 'codemode'.
  • codemode_unsupported_tool: a tool marked callableBy: 'codemode' needs approval, input, an interaction, or background activation, is question or subagent, or has nestedToolAccess. These tools never run from code mode; use callableBy: 'all' or 'model'.

A logged warning, Code-mode-only tools are unreachable from model turns without a nested tool access registration, means you marked tools callableBy: 'codemode' but did not register the code mode tool (or another nestedToolAccess registration) in the same resolution. Scripts you run yourself through ResolvedToolSet.nestedExecutor still reach them; ignore the warning for resolutions used only for those. See Choose what scripts can call.

Staged tool plans add three causes:

  • staging_unsupported_policy: a tool sets staging without approval, or combines it with input, an interaction, background execution, nested tool access, or callableBy: 'model'.
  • staging_validation_required: a raw stageable registration has no side-effect-free validate.
  • plan_review_duplicate: more than one makePlanReviewTool registration resolves.

Tool change previews add one cause:

  • change_preview_unsupported_policy: a tool sets changePreview without approval.

Typed tool results add one cause:

  • output_validation_required: a registration sets def.outputSchema without decodeOutput. makeTool with output sets it; raw registrations pass toolOutputDecoder(schema), MCP registrations mcpToolOutputDecoder, and wrappers that rebuild a registration field by field must forward it. See Typed outputs and file fields.

stage is not defined, or review_plan is unavailable

Scripts get stage(name, args), and the review tool becomes available, only when the resolution has plans, an interactionHost, and exactly one plan review tool, and the code mode tool does not set staging: false. Voice and subagent resolutions without them never get it.

A plan store outage is never reported as invalid input: prepareToolBatch fails with ToolError unavailable (retry the step) and admission answers InteractionAdmissionError unavailable. See Review a staged plan.

Code mode worker or quickjs.wasm not found

The Node executor loads a worker file and quickjs.wasm from disk. When a bundler inlines the engine, those files are missing at runtime. In Next.js, add @yolk-sdk/codemode, @earendil-works/pi-codemode, and quickjs-wasi to serverExternalPackages, or pass wasm and workerUrl to makePiCodeModeExecutor. See Add code mode.

Approval requests have no preview

Pending ToolApprovalRequests carry preview only when you pass approvalPreviews: toolSet.approvalPreviews to run, runToolBatch, prepareToolBatch, or the runtime config, and the tool has a changePreview hook. Voice approvals never compute previews. When previewError is set instead, its cause says why: failed (the hook failed or the arguments are invalid), invalid (not a ToolChangePreview), too_large (labels, target, summary, warnings, or blocked alone exceed maxBytes), or timeout. Show the raw arguments in that case. See Preview the change.

A file shows as "file not captured" or FileUnavailable

A tool returned a file that was not stored or could not be verified: a FileBytes or FileStored in a typed tool's ToolFile field (the script value holds FileUnavailable { unavailable, name, mimeType }) or an untyped tool's FilePart. The model sees [file not captured (reason): name, mime] instead of a fileId. The reason says why:

  • no file store: pass files: { store } to resolveTools on that surface (MCP calls outside resolveTools: pass fileCapture: makeToolFileCapture({ store })).
  • too large: the file is over maxFileBytes (default 100 MiB).
  • storage unavailable: the store failed; check its logs.
  • storage timed out: an interaction result's files were not stored within the bound before its receipt was settled.
  • invalid base64: an MCP server or an untyped tool returned malformed bytes.
  • not found: a FileStored names a file the store's scope does not hold (not written yet, a malformed fileId, or another scope's).
  • size mismatch: a FileStored's size differs from the stored file's; the write was cut or named the wrong file.

Typed file fields take FileBytes or FileStored only, never base64 strings or plain objects: decode the bytes yourself (base64ToBytes) before returning them. File tools report a missing or foreign fileId as not found. A file_upload that got no complete response has an unknown outcome: check the destination before retrying. See Move files between tools.

A script call rejects with returned an invalid result

A code mode call of a typed tool rejects with <label>: returned an invalid result when the result reaching the script has no value: the tool returned no structuredContent, or resolveTools dropped a value that did not match the output schema (an excess property, a wrong type, or a value that is not plain JSON). The model still saw the content. A warning naming only the tool (never the value) is logged: fix the tool so its value matches its output, or return { output } from makeTool so Yolk encodes it. Scripts never fall back to text.

Attachment tools return { value, files } instead of base64

gmail.get_attachment, outlook.get_attachment and email.get_attachment used as agent tools resolve to { value, files }: value is the metadata output, files the attachment as a FileRef (or FileUnavailable). Move it with the @yolk-sdk/files tools, or call connector.invoke for the base64 output.

Approval pauses forever

If a tool has manual approval, the loop emits AgentAwaitingInput. Your host must persist pending request ids and resume with matching HITL responses (Workflow hosts: match the named pause; see HITL resume).

Streaming errors

Browser receives one big chunk

Disable buffering at your platform/proxy and use streaming-friendly headers.

Also confirm provider streaming configuration: generic OpenAI chat and Vercel AI Gateway default to one JSON body, so a host expecting incremental events must set streaming: true against an endpoint that serves chat SSE. Unterminated chat streams fail invalid_response (incomplete_stream) without Done; treat them as failures, not quiet completion. Gateway's independent reasoningContent: true option preserves compatible reasoning output and assistant replay; enabling streaming alone does not retain reasoning. Replayed reasoning spends input tokens.

For NDJSON routes, use content-type: application/x-ndjson and avoid middleware that buffers responses.

Client never completes

Streams reach a logical client boundary after AgentEnd, AgentError, or AgentAwaitingInput. Use isTerminalAgentEvent when writing custom consumers, but do not treat resumable AgentAwaitingInput as a final Workflow close.

Collector failed versus host-chosen recovery

collectModelTurn returns a finalized ModelTurnResult or re-fails. collectModelTurnAttempt keeps a partial ModelTurnCollection on typed StreamFailed or SinkFailed. An onEvent sink error is not a model-recovery outcome. Defects, interrupts, and mixed Causes stay Causes rather than those tags.

Kernel responseIssue: 'missing_done' is an incomplete stream, not automatic provider/tool replay. Providers whose wire requires a terminal event set it too when the stream ends before any Done: Claude and native Messages without message_stop, Grok and OpenCode Go responses without response.completed (still providerCode: 'incomplete_stream'). Harness hosts then get Continue (output started) or RecoverFull (none) instead of a failed run. Codex completes a stream cut before response.completed (EOF compatibility) and recovers a final response with missing output; see OpenAI Codex.

@yolk-sdk/harness/outcome classifies one invocation after inner loop/provider retries. It does not add an outer retry loop. Hosts that opt in choose whether to schedule another physical attempt. See Loop and runtime and Harness composition.

MCP errors

Remote MCP URL rejected

Remote MCP requires HTTPS by default. http://localhost is only for development policy.

Local MCP fails in browser or edge runtime

Stdio MCP is Node-only. Keep it behind @yolk-sdk/mcp/client/node and run it from a Node host.

Tool result shape differs from agent results

Use the MCP client/server adapters so isError and supported content blocks are preserved. A successful call's structuredContent is { value, files } (the server's structuredContent is value); blobs, images and audio are files, stored as FileRefs or FileUnavailable. See Add MCP tools.

Knowledge errors

Search returns nothing

Check search scope, document ids, chunk ingestion, embedding dimensions, and host permission filters.

Ingestion compiles but fails at runtime

The package defines contracts. Your host must provide extraction, chunking, embedding, summarization, and SearchIndexStore layers. For file bytes, FileKnowledgeExtractorLayer from @yolk-sdk/extractors/knowledge provides extraction when given FileExtractorLayer from @yolk-sdk/extractors/node; see Ingestion pipeline.

Connector errors

Credential binding missing

Connector provider modules declare credential slots needed by their actions. Bind the slots required by your selected connector/actions to host credential refs with makeCredentialBinding.

Provider request fails

Provide a ConnectorHttpClient layer. Preserve method, URL, headers, body, and content type exactly when adapting to your HTTP client.

Generic email action fails before transport

Provide EmailClient and CredentialResolver layers. Incoming actions require incomingHost plus an EmailIncomingCredentialSlot binding; SMTP send requires smtpHost plus an EmailSmtpCredentialSlot binding. The slots may point to the same credential ref, but one binding does not silently satisfy the other. Both slots require UsernamePasswordCredential; use the Google or Microsoft connector for their provider-specific OAuth flows.

Use only none, starttls, or tls for security and ports from 1 through 65535. POP3 has no folder or draft model, so omit folder for reads and configure IMAP for email.create_draft. When a draft omits folder, the host adapter must discover a mailbox advertised with \Drafts by the IMAP SPECIAL-USE extension and may fall back to Drafts; servers without UIDPLUS may save successfully without returning draftId. SMTP { accepted: true } means the server accepted the submission; it does not prove delivery. Transport failures should remain typed ConnectorError effects, while expected server rejection should be returned by the host port as ActionResult.failure.

Generic email filters, batches, labels, flags, and moves fail

email.list_messages with isRead or isFlagged requires IMAP and optional EmailClient.listMessagesFiltered; it never falls back to legacy listMessages. POP3 filters fail before credentials. A missing method is a typed validation error, and malformed successful list output is rejected at the connector boundary.

Batch/delete actions require 1-100 unique nonempty messageIds; duplicate, empty, or oversized inputs fail before credentials or host calls. Each action also needs its matching optional EmailClient.batch* or deletePermanently method. Successful output must cover every requested ID in messageIds order, use only succeeded | failed | unknown | not_attempted, include consistent summary counts, and keep error codes sanitized. Successful move-shaped results require destination folder; only movedMessageId is optional. For permanent deletion, use UID-scoped deletion of exactly the requested IDs; never blanket EXPUNGE. SDK success does not prove backup or retention erasure.

Gmail batch failures expose sanitized codes only (invalid_request, unauthorized, forbidden, not_found, conflict, precondition_failed, payload_too_large, locked, rate_limited, provider_rejected, outcome_ambiguous, invalid_response, batch_stopped): never provider bodies or credentials. unknown means the mutation may have executed, so reconcile before retrying; not_attempted means no request was sent. Outlook batch results use the same codes plus invalid_batch_response (broken envelope correlation) and prerequisite_failed (a category read failed, so no PATCH was sent). Later chunks stop after auth/permission rejection, throttling, transport ambiguity, server failure, or broken correlation; already-established results are preserved. Combining fresh isRead/isFlagged filters with an Outlook nextLink fails before credentials: reuse the returned nextLink unchanged instead.

Label, flag, and move inputs are validated before any host call: EmailImapKeyword rejects system flags such as \Seen, whitespace, control characters, and IMAP atom specials; email.modify_labels requires at least one of addLabels/removeLabels; email.move requires a destinationFolder that differs from the source folder. Hosts return ActionResult.failure for keywords the server rejects (check PERMANENTFLAGS first) and for missing destinations. A moved message gets a new destination UID, so omitted messageId means re-list the destination rather than reusing the source UID. Hosts own partial-move reconciliation. See the generic-email catalog.

Google Drive action is unauthorized or search is incomplete

All Google workloads share the google.oauth credential binding, but the resolved token still needs the selected action's consent. Drive list/search/get request drive.metadata.readonly; folder create, trash, and permanent delete request drive.file. The latter only covers files the app created or that the user explicitly opened/shared with the app. Use Google Picker or equivalent host-owned UX to grant per-file access. If the product must mutate arbitrary existing files, the host owns broader restricted-scope consent, Google verification, storage/security requirements, and authorization policy.

For shared-drive list/search, pass that shared drive's driveId. If output reports incompleteSearch: true, narrow the search to one drive rather than assuming the page is complete. Pass nextPageToken back unchanged as pageToken. Google still checks returned file capabilities, ownership, shared-drive role, and administrator policy for destructive calls.

For a protected link-shared item, pass its returned resourceKey with get/trash/delete or parentResourceKey with parent-scoped list/search/create. The connector sends X-Goog-Drive-Resource-Keys; omitting the key can look like a permission failure even when the user opened the item through Picker. Drive quota-related 403 reasons map to google_rate_limited rather than re-consent errors; honor retryAfterMs when present.

The connector excludes trashed files unless includeTrashed is true. Prefer drive.trash_file for reversible removal; drive.delete_file permanently bypasses trash. Upload/download is not in the string/JSON HTTP port, so the host must transfer binary content separately.

Dropbox download fails

Binary download is not a dropbox.* action and is never serialized by makeConnectorToolModule; a missing download tool is expected. Use host-only downloadDropboxFile with a compliant ConnectorBinaryHttpClient — do not reuse string ConnectorHttpClient. credential_failed means the dropbox.oauth binding or its files.content.read slot could not be resolved; unauthorized usually means the token lacks that scope (Dropbox reports missing_scope). invalid_input covers share links, relative paths, control characters, and Dropbox malformed_path. not_a_file is a folder; not_downloadable is a Paper or other export-only entry; unexpected_redirect means the adapter returned a 3xx that the helper refuses to follow. partial_content covers incomplete or ranged 200 responses and a body whose length differs from the served metadata size. Host-only writes use a separate port; see Transfer connector files.

Gmail draft lines are hard-wrapped after sending

Drafts from gmail.draft_compose, gmail.draft_update, and gmail.draft_reply before 0.1.0-canary.102 were plain text only, which Gmail web opens in its plain-text composer and wraps at about 70 columns when a person sends them. Upgrade, and write each paragraph of a text body as one line (never wrap by hand). Recipients then see the HTML part unwrapped; the text/plain alternative Gmail web regenerates on send is still wrapped at about 76 columns, as for any message composed there. See Gmail draft bodies.

Gmail draft with attachments fails

A validation_failed error from gmail.draft_compose, gmail.draft_update, or gmail.draft_reply with underlying.reason: 'too_large' means the decoded MIME exceeds 35 MiB and nothing was written. More than 10 attachments or over 25 MiB decoded in total also fails validation_failed, from input validation. A draft with attachments is one multipart/related upload: a host HTTP adapter that re-encodes the string body or caps outgoing bodies below about 35 MiB breaks it, so forward the body exactly as UTF-8. Against the Google emulator, the draft media upload is not emulated and answers its unrecognised 400. See Gmail draft attachments.

Gmail submission is unconfirmed or its send scope is rejected

gmail.send_message forwards host-generated base64url MIME unchanged. Its input validation checks encoding, not MIME structure, recipient correctness, or sender aliases. A validation_failed error with underlying.outcome: 'rejected' and reason: 'too_large' means nothing was sent: keep decoded MIME at or below 35 MiB. 7-bit MIME uses Gmail's multipart upload; 8-bit MIME keeps the JSON raw request, so prefer quoted-printable/base64 parts for large messages. The host must construct and review the message before dispatch. A valid success returns an accepted message ID, not delivery confirmation. HTTP ambiguity, transport errors, or malformed success acknowledgements can follow an actual send; do not automatically resend. Reconcile mailbox state first. Failure metadata uses underlying: { outcome: 'rejected' | 'unknown', retryable: false } after a response, or the unknown variant on after-dispatch typed errors; neither includes provider bodies or retry-delay hints.

The action's slot hints gmail.send, but Google also accepts gmail.compose, gmail.modify, or https://mail.google.com/. The action inspects OAuth scope metadata, then re-resolves through a slot for the existing sufficient grant; the host must still authorize that operation slot. Return accurate scopes on OAuthCredential so compose-only credentials do not fall back to a literal send hint. Bearer credentials or missing scope metadata use the send slot. Do not weaken unrelated scope checks or add unnecessary consent. See Gmail submission.

Microsoft action is unauthorized

Microsoft Outlook and OneDrive actions call Microsoft Graph, so the token audience and consent must be for Graph rather than the retired outlook.office.com/api endpoint. This applies to tokens only: addOutlookAttachment session ranges go to Graph-issued, pre-authenticated outlook.office.com/api/.../AttachmentSessions(...) URLs through uploadSession, without Authorization. Read actions need Mail.Read, draft actions need Mail.ReadWrite, and send actions need the separate Mail.Send permission. All action-scoped credential slots share the microsoft.oauth binding id.

An explicit mailbox equal to OAuthCredential.accountId (case-insensitive, no whitespace trimming) keeps ordinary Mail.* scopes. If your own mailbox unexpectedly asks for Shared scopes, verify the host populated accountId with the same Graph user ID or userPrincipalName form as mailbox; missing identity, aliases, and ID-versus-principal-name mismatches do not qualify. Delegated explicit-mailbox actions resolve the scope-free identity slot before the enforcing operation slot.

When mailbox targets another Exchange Online mailbox, delegated tokens need the corresponding Mail.Read.Shared, Mail.ReadWrite.Shared, or Mail.Send.Shared permission. Reads and writes need the relevant shared-folder or Full Access grant. Sending requires Send As or Send on Behalf; the connector's /users/{mailbox} send path also requires Full Access. Microsoft Graph cannot list which mailboxes the signed-in user may access, so the host must obtain and authorize the mailbox identifier.

Application-token hosts set integration config mailboxAccessMode to application and must provide mailbox. Grant the non-Shared application permission and apply mailbox scoping through host/admin policy.

A successful send returns { accepted: true } when Graph responds 202 Accepted. This means Graph accepted the submission; it does not prove processing or delivery. Honor retryAfterMs when a provider failure maps a Graph 429 response only after establishing that retrying the operation is safe. A retry delay is not a guarantee that the operation had no side effects.

For outlook.create_reply_draft, a post-create HTTP failure uses outlook_create_reply_draft_partial and omits retryAfterMs, even for 429. Both these failures and post-create typed ConnectorErrors include underlying: { draftId, retryable: false, recovery: 'read_edit_existing_draft' } once the draft ID is known. Read and edit that draft using the original mailbox instead of invoking creation again: a failed save response may follow a successful save. If the creation response was lost or no usable ID was returned, reconcile mailbox state before another creation. See reply draft recovery.

For outlook.update_draft, the body is a complete replacement, not a reply to prepend. Omitted fields are unchanged and empty arrays clear recipient fields. After-dispatch HTTP failures use outlook_update_draft_failed; typed failures also preserve the existing draft ID with retryable: false and recovery: 'read_edit_existing_draft'. Read the original draft/mailbox before any further edit or send. Update then send is not atomic, and the interaction host cannot prevent another mailbox client from changing the provider draft between calls.

For outlook.reply, the reviewed recipients, subject, and complete body travel in a single send request, so there is no intermediate mutable draft. Only HTTP 202 Accepted returns { accepted: true }; recognized rejections use outlook_reply_rejected and anything else (including other 2xx statuses, redirects, 408, and 5xx) uses outlook_reply_unknown, both with underlying: { outcome: 'rejected' | 'unknown', retryable: false } and no retry hints or provider bodies. Typed after-dispatch failures carry the unknown variant. Acceptance means submission, not delivery: reconcile mailbox state before considering another send.

For OneDrive, delegated reads and writes use Files.Read or Files.ReadWrite by default, including an explicit driveId when those permissions cover the target. Set oneDriveAccessMode to delegated_all when broader delegated access requires Files.Read.All or Files.ReadWrite.All. Application-token hosts set it to application and must provide driveId; apply tenant/admin policy to limit the app's accessible drives. Reusing an Outlook credential works only when its consent also includes the required Files.* permission.

If OneDrive pagination is rejected, pass the full Graph nextLink unchanged and repeat driveId. For onedrive.list_items, also repeat the original parentItemId. Binary download is not a connector action and is never serialized by makeConnectorToolModule; a missing download tool is expected. Use host-only downloadOneDriveItem with a compliant ConnectorBinaryHttpClient — do not reuse string ConnectorHttpClient. invalid_input covers bad or dot-only IDs and application mode without driveId. credential_failed means missing microsoft.oauth or the Files.Read / Files.Read.All slot. Size and partial failures include response_too_large and partial_content; do not trust metadata size. The adapter must disable auto-redirects; the helper strips headers after the first content request. Host-only create/update are supported; see Transfer connector files.

New file helper fails or a write outcome is uncertain

New helpers use ConnectorFileTransferError, with code-only failures. invalid_input fails before credentials/network; response_too_large means a host/provider byte bound was exceeded; upload_session_required from other upload helpers means the file exceeds that provider's single-request cap and no session flow is implemented. From addOutlookAttachment it means a file of 3 MiB or more needs ConnectorBinaryWriteHttpClient with the optional uploadSession method; files under 3 MiB do not. See Attach a file to an Outlook draft. Never increase limits using model input. not_downloadable includes unsupported native exports, folders, and item/reference mail attachments. Drive content needs drive.file or explicitly authorized drive.readonly, not metadata-only consent. Notion external files require host URL policy.

conflict is not permission to retry without a revision/ETag. OneDrive simple replacement is unconditional and requires explicit overwrite acknowledgement; decline when atomic CAS is required. A transport timeout, cancellation or invalid success can follow a committed write: inspect provider state and reconcile before another attempt. No helper retries writes automatically. Hosts must still enforce streamed bounds, cancellation, DNS/socket policy, TLS and secret-safe telemetry.

Sandbox errors

Workspace resets unexpectedly

Disposable sandbox lifecycle can recreate stale or max-expired sessions. Treat workspaceReset: true as a signal to refresh app UI/state.

Command cannot access a path

Sandbox cwd is workspace-relative. Absolute paths and .. escapes are rejected.

Command times out

Timeout is owned by Yolk. Long-running commands may be killed and returned as command-result data, not stream failure.

Vercel Workflow errors

Background launch completes but child output is missing

makeSubagentAcceptedToolResult acknowledges launch only. It intentionally adds no child usage or SubagentCompleted. Choose a host-owned completion policy: deliver findings automatically or expose authenticated observation tools and durable lookup. If observations use new tool-call ids, do not complete the original launch twice. The SDK registers no status or wait tools. See Background subagents.

Child steps run inline or waiting never finishes

Do not put an entire child loop inside one parent 'use step': nested step calls execute inline. Orchestrate an independent Workflow start outside that step. Use awaitWorkflowChild with short read steps and Workflow sleep; treat failed/cancelled children as terminal values. The helper has no built-in timeout, and independent children need explicit host Stop policy. Use the zero-based read/sleep attempt indices for host observation budgets and capped backoff. At the ceiling, return a truthful still-running or unknown value with a recovery handle; ending observation does not terminate the child. Map nonterminal subagent results with the matching observation marker to avoid false completion. Also check orchestrateWorkflowToolBatch failures even when ready: true; it may return partial progress. See Bounded child observations.

Missing intrinsic getter: href at import

workflow 5.x hardens serialization by capturing Node URL intrinsics when the module loads and rejects jsdom's URL shape. Run any test whose import graph reaches the workflow package (any entrypoint, including through @yolk-sdk/vercel-workflows) in a node vitest environment — add // @vitest-environment node or exclude those suites from jsdom projects. TestWorkflowWorld loads the same runtime when it executes a step, so under jsdom runStep fails with an error starting "TestWorkflowWorld cannot load the workflow step-error serializer"; see Step errors.

A custom error class or field is lost across a step boundary

The platform stores a step's thrown value and the workflow body reads it back: error tags, prototypes and custom fields are gone, and only message, name, stack and a serializable cause survive. Carry what the workflow body must read as plain data in cause. A class instance anywhere in the cause chain makes the error unstorable, and the step is redelivered until it exceeds its retries; in tests, assert world.inspect(runId).unstorableStepErrors is empty. See Step errors.

Workflow build reports duplicate step ids

Two ws versions can make the package manager install @workflow/core twice, once per peer variant, and the Workflow build then sees each step twice. @effect/platform-node 4.2.0 requires ws ^8.23.1; dedupe it, for example with a pnpm override ws: ^8.23.1.

Deployed streams arrive in multi-second bursts

On workflow 4.x the hosted backend served durable streams only from iad1; deployments in other regions paid a cross-region round trip per 10 ms write batch, with writer backpressure compounding the delay. Upgrade to workflow@^5.0.0-beta.42: 5.x region-pins each run so storage, queuing, and streams are served from the run's own region.

Tool ran twice after a crash or redelivery

The Workflow queue is at-least-once: a tool-batch step runs again after a crash, and sometimes while its first execution is still running, even with noWorkflowStepRetry. Without a ledger, every tool call in that step runs again. Pass a durable store with resolveTools(modules, context, { ledger: { store } }) inside the step, scoped to the run (plus the turn or step if call ids can repeat). Input and interaction tools are never ledgered; they rely on your InteractionHost receipts. See Ledger writes for re-executed steps.

Ledgered call returns unavailable, conflict, or may already have been applied

  • ToolError with reason unavailable: the store failed to claim or poll. The call fails closed and nothing runs. Check store connectivity, and keep store operations interruptible.
  • Conflict: the same ledger key holds a different tool name or argsDigest, usually because a provider reused a call id within the scope. Add the turn or step to the scope.
  • "May already have been applied": an earlier execution's lease expired without an outcome (a crash or a step stopped mid-call). The call never re-runs; verify the side effect before retrying.
  • Timeout while waiting for an in-flight call: maxWaitMs (default 150 s) or deadline passed.
  • A step overruns its budget after a call: recording the outcome can take about 15 s after deadline. Pass a deadline that leaves that finalization time before the platform stops the step.

Log onLedgerDecision to see which decision each call got.

Duplicate or replayed events

Durable clients should de-dupe by eventId when available and resume from the last known stream index.

Stream fails on LLMReasoningReplay

An older SDK cannot decode the LLMReasoningReplay event that newer servers emit for Claude thinking. Upgrade clients with servers, reload open tabs, and do not read newer durable logs with an older SDK.

HITL resume fails

Your host owns hook tokens, route auth, run ownership, and pending request matching. The package only carries serializable awaiting-input state.

An answer that resumeHook accepted but the run never used went to a hook that had already taken another answer (a live hook accepts every payload and the workflow reads the first), or to the next pause through a token several pauses share. Use one token per pause and record answers durably before resuming (HITL resume).

An answer taken for the wrong pause (a late retry filling a later pause, or a new answer taken for a retry of an old one) was matched by request id alone. Requests re-pend under the same id after an invalid answer, and providers reuse call ids across turns. Have the client name the pause it answers, the eventId of its AgentAwaitingInput, and match strictly by it (Name the pause).

HookNotFoundError means no hook is resumable under that token right now: the workflow has not created it yet (a client faster than the replay after AgentAwaitingInput), the token is wrong, the hook was disposed (its answer already used, possibly by an earlier attempt of the same resume), or the run ended. While the stored pause is still pending, retry resuming the recorded answer a bounded number of times; once the pause has moved on, report the recorded answer as delivered.

Terminal event missing

For AgentEnd, commit durable state, write the event, then let closeStream close. For AgentError, writeError must write the safe event and close. Do not final-close after resumable AgentAwaitingInput; release the writer lock and continue the same Workflow run after the hook resolves.

On this page

Package and module errorsCannot find an exportNode or ESM errorsEffect layer errorsMissing serviceProvider errorsMissing OpenAI provider environment configurationMissing Vercel AI Gateway environment configurationDiagnose provider failures with providerCodeClaude rejects a model with claude_code_version_too_oldDiagnose chat stream failures with stream diagnosticsProvider returned a tool call with an empty nameOAuth provider returns unauthorizedGrok allowance returns HTTP 412Media input rejectedAnthropic context is too longClaude reaches max_tokensClaude thinking ended without a signatureTool errorsTool is not configuredTool input validation failedTyped input is unavailable or stays pendingAction-backed interaction is unavailable or reappearsCode mode tool resolution failsstage is not defined, or review_plan is unavailableCode mode worker or quickjs.wasm not foundApproval requests have no previewA file shows as "file not captured" or FileUnavailableA script call rejects with returned an invalid resultAttachment tools return { value, files } instead of base64Approval pauses foreverStreaming errorsBrowser receives one big chunkClient never completesCollector failed versus host-chosen recoveryMCP errorsRemote MCP URL rejectedLocal MCP fails in browser or edge runtimeTool result shape differs from agent resultsKnowledge errorsSearch returns nothingIngestion compiles but fails at runtimeConnector errorsCredential binding missingProvider request failsGeneric email action fails before transportGeneric email filters, batches, labels, flags, and moves failGoogle Drive action is unauthorized or search is incompleteDropbox download failsGmail draft lines are hard-wrapped after sendingGmail draft with attachments failsGmail submission is unconfirmed or its send scope is rejectedMicrosoft action is unauthorizedNew file helper fails or a write outcome is uncertainSandbox errorsWorkspace resets unexpectedlyCommand cannot access a pathCommand times outVercel Workflow errorsBackground launch completes but child output is missingChild steps run inline or waiting never finishesMissing intrinsic getter: href at importA custom error class or field is lost across a step boundaryWorkflow build reports duplicate step idsDeployed streams arrive in multi-second burstsTool ran twice after a crash or redeliveryLedgered call returns unavailable, conflict, or may already have been appliedDuplicate or replayed eventsStream fails on LLMReasoningReplayHITL resume failsTerminal event missing