TanStack / TanStack/ai

Client-tool `output-error` state is lost during native interrupt resolution

Open
#1,219 0 comments 0 reactions 1 assignee View on GitHub

@tombeckenham is already working on this.

Since Sep 17, 2026.

has-pr waiting-on: maintainer
Dominant language
TypeScript
Stars
3.1k
Forks
331
Avg merge
1d 22h
Merged PRs (30d)
160

Description

TanStack AI version

0.48.0

Framework/Library version

@tanstack/ai-client: 0.26.0 | @tanstack/ai-svelte: 0.18.3

Describe the bug and the steps to reproduce it

Server and client tools share output-available / output-error. A server tool that throws or fails output validation becomes a failed ToolResult with { error: message } and state: 'output-error', and the agent loop continues.

A client tool uses an interrupt only because the server must pause while the browser executes.

Resolving that interrupt means execution finished, not that it succeeded. Native resume should keep the same result state. What happens instead:

When the success schema rejects { error }, the client blocks the native resume as invalid-tool-output, or durable server validation rejects it when the client has no matching schema.

When the tool has no output schema, or its schema accepts { error }, the resume succeeds but reconstructs the failure as output-available.

Both outcomes lose the original result state instead of continuing the agent loop with a failed tool result.

Expected behavior

Native client-tool resume should carry ClientToolResult state across the browser-server boundary.

The interrupt can stay status: 'resolved' because execution completed. Resume metadata should distinguish:

{ state: "output-available", output: unknown }
{ state: "output-error", errorText: string }
  • A known output-error from execution, output validation, or canonicalization should resolve the pause as a failed tool result and skip the successful output schema.
  • resolveClientToolOutput() should remain success-only. Before local transcript mutation or resume staging, addToolResultForClientTool() should validate and canonicalize an output-available value; either failure should use the explicit output-error path.
  • validateCandidate() should enforce the same success invariant for direct resolutions, report either failure as invalid-tool-output, and return an already-canonical value for applyValidation() to commit.
  • The server should validate output-available against the tool schema, validate output-error against a fixed canonical error representation, and reconstruct the same failed ToolResult as server execution ({ error: message }, state: 'output-error').
  • The agent loop continues instead of rejecting the resume.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://stackblitz.com/edit/vitejs-vite-xcs8bcc9?file=src%2Fmain.ts

Do you intend to try to help solve this bug with your own PR?

Yes, I am also opening a PR that solves the problem along side this issue

Terms & Code of Conduct
  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.