Skip to content

[Bug]: Errors whose cause is a string defect show only "An error occurred." #41542

Closed

Description

@ttulttul

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

Errors whose cause is a string defect show only "An error occurred."

Steps to reproduce

  1. Connect T3 Code to a server that answers projectClone.start with a defect. Any server will do; a remote control plane that doesn't implement the method returns:
    {"_tag":"Exit","requestId":"…","exit":{"_tag":"Failure","cause":[{"_tag":"Die","defect":"RPC contract is registered but unavailable in the control plane: projectClone.start"}]}}
  2. In a project on another machine, open Add to another machine, choose that server as the target, and click Clone to ….

Expected: the dialog shows the defect text, or at least something that points at it, such as "projectClone.start is unavailable on this server".

Actual: the dialog shows only "An error occurred.", and nothing in the UI says which call failed or why.

Cause

squashAtomCommandFailure returns Cause.squash(cause). For a Die cause whose defect is a string, that is the string itself, not an Error. Every caller then formats it like this:

  • apps/web/src/lib/addProjectToMachine.ts failureMessage (main, ba70b56):
    const error = squashAtomCommandFailure(result);
    return thrownErrorMessage(error, m) ?? m(msg("An error occurred."));
  • packages/client-runtime/src/errors/translatable.ts thrownErrorMessage:
    if (!(error instanceof Error)) return null;

So any non-Error value (a string defect, or a plain object) falls through to the generic message. The same instanceof Error ? … : "An error occurred." pattern appears in about 100 places in apps/ and packages/: BranchToolbar, ChatView.logic, CommandPalette, ProjectCloneToastCoordinator, useProjectCloneBanner and others.

Environment

  • T3 Code desktop, web client at pingdotgg/t3code main ba70b56b14 (2026-11-23).
  • Target server: a t3code-rust embedded control plane (Cloudflare Durable Object build). Any server that returns a string defect reproduces it.

Notes

The server's reply above was captured from a local run of that control plane. The client behaviour is traced from the code paths above; I haven't stepped through it in a debugger.

Expected behavior

Have thrownErrorMessage (or a shared helper the call sites use) fall back to readable text for non-Error failures:

if (typeof error === "string" && error.trim() !== "") return error;
if (error && typeof error === "object" && typeof (error as { message?: unknown }).message === "string")
  return (error as { message: string }).message;

Keep "An error occurred." for values with no text at all. Optionally, log the squashed cause to the console whenever the generic message is shown, so the real reason is at least discoverable.

Actual behavior

When an RPC fails with a defect ({"_tag":"Die","defect":"<string>"}), the web client discards the defect text and shows the generic "An error occurred.". The server's explanation never reaches the user. This happens in "Add to another machine" and in most other places that report a command failure.

Impact

Minor bug or occasional failure

Version or commit

main @ ba70b56

Environment

macOS 27.0.1 (26A434)

Logs or stack traces

Screenshots, recordings, or supporting files

t3error.jpg

Workaround

No response

Activity

  1. added
    bug
    needs-triage
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions