Genie React

Your error boundary caught the error and rendered nothing

An empty card with no error message can be a TypeError that an error boundary swallowed. Genie's react_error_state names the boundary, the thrower and the line.

An empty card with no spinner and no error message often means an error boundary caught a render error and returned null. Nothing on screen says anything failed. Genie's react_error_state reports the boundary, the component that threw, the message, the source line, and rendered.output: nothing, which means the user sees no trace of it.

This walkthrough uses the account screen of the agent eval fixture in evals/fixture-app, a React 19.2 app with TanStack Query 5 and Vite. The bug is seeded, with an answer key in error-boundary-hidden.json. Every command and output below comes from one session on 2026-11-19 with Genie 1.1.0. The full, untrimmed output is in the evidence file.

The symptom: a card with only its title

The bug report says: "On the Account screen the Profile card is completely empty: no error message, no spinner, nothing." Open the screen and read the card's text:

agent-browser --session upd-a open 'http://localhost:5231/?screen=account'
agent-browser --session upd-a get text '[aria-label=Profile]'
Profile

The card shows its heading and nothing else. The Security card next to it renders normally, so the app did not crash as a whole.

The evidence: a caught TypeError with no output

Ask Genie which error boundaries caught something:

npx genie-react call react_error_state '{}' --session upd-a

Output, trimmed to the decision fields of the one caught error, the first two stack frames, and the hint:

caughtErrors[1]:
  - {boundaryId:13240864079892,boundaryName:CardBody,boundaryKind:error-boundary,boundarySource:{file:/src/screens/account/AccountScreen.tsx,line:10,column:9,functionName:AccountScreen},throwingComponent:ProfileDetails,message:"Cannot read properties of undefined (reading 'city')",stackFrames:[{functionName:formatLocation,file:/src/screens/account/ProfileDetails.tsx,line:6,column:21,isLibrary:false,mapping:mapped},{functionName:ProfileDetails,file:/src/screens/account/ProfileDetails.tsx,line:19,column:12,isLibrary:false,mapping:mapped},…],isLibraryBoundary:false,forced:false,status:active,statusReason:state-unchanged-since-catch,rendered:{output:nothing,hostNodes:0,text:null}}
suspended: []
blankTreeHint: "error boundary <CardBody> at /src/screens/account/AccountScreen.tsx:10 caught \"Cannot read properties of undefined (reading 'city')\" thrown by <ProfileDetails> — its children did not render and it renders nothing in its place, so the failure is invisible on screen"

Read it field by field:

  • boundaryName: CardBody is the boundary that caught, used at AccountScreen.tsx:10.
  • throwingComponent: ProfileDetails threw.
  • The first stack frame is formatLocation at ProfileDetails.tsx:6, mapped through source maps.
  • status: active means the boundary is still in its error state.
  • rendered: {output:nothing,hostNodes:0} means the boundary put zero DOM nodes on the page in place of its children.

That last field separates this bug from a slow query. A pending query leaves ProfileDetails mounted, showing Loading profile…. Here it is gone, and nothing replaced it.

The cause: two bugs in two files

The thrower reads a field that the data does not have. The Profile type marks address optional, and the API returns a profile without one:

function formatLocation(profile: Profile): string {
  const address = profile.address as NonNullable<Profile['address']>
  return `${address.city}, ${address.country}`
}

The as NonNullable<...> cast tells TypeScript the address is always there. At runtime it is undefined, and address.city throws.

The boundary then hides the throw. CardBody has getDerivedStateFromError, so React treats it as an error boundary, and its fallback is null:

render() {
  return this.state.failed ? null : this.props.children
}

Fix the throw, then verify

The answer key's reference fix handles the missing address:

@@ -1,9 +1,8 @@
 import { useQuery } from '@tanstack/react-query'
 import { api, type Profile } from '../../api'
 
-function formatLocation(profile: Profile): string {
-  const address = profile.address as NonNullable<Profile['address']>
-  return `${address.city}, ${address.country}`
+function formatLocation({ address }: Profile): string {
+  return address ? `${address.city}, ${address.country}` : 'Not provided'
 }
 
 export function ProfileDetails() {

The error happens on page load, but verify needs the React work to happen inside its window. Open the window, then reset the profile query so ProfileDetails loads its data again:

npx genie-react verify begin --session upd-a --name 'reload profile' --claim 'render ProfileDetails min 1' --claim 'boundaries clean'
npx genie-react call query_reset '{"queryKey":["profile"]}' --session upd-a
npx genie-react verify end vfy_a075dbd1-c899-41c6-b6e8-60c641f836b8 --session upd-a

boundaries clean holds when no error boundary caught during the window and none is in an error state at the end. render ProfileDetails min 1 is the positive control: it proves the reset reached the component.

Before the fix, on the second run, trimmed to the verdict, the claim lines, the deciding evidence and the history line (exit code 1):

fail vfy_a075dbd1-c899-41c6-b6e8-60c641f836b8 "reload profile"  0 commits, quiet after 616 ms (react, query, network)
  1 refused render ProfileDetails min 1  target_not_found: No ProfileDetails instance was mounted at begin or rendered in the window; a target Genie cannot see is not a target that did nothing.
  2 fail boundaries clean  {caughtDuringWindow:0,caughtAtEnd:1}
      deciding: [{kind:boundary-at-end,boundary:CardBody,boundaryKind:error-boundary,message:"Cannot read properties of undefined (reading 'city')"}]
attempt 2 for these claims on this tab; previous fail vfy_871b0f9e-cfd3-4c44-a442-ecd686ca109a; document reloaded since

ProfileDetails is not mounted, because CardBody replaced it with null. The reset caused zero commits. The run still fails, and a fail outranks a refusal: CardBody is in its error state at the end of the window.

The last line ties this run to the first run of the same claims on this tab. It names no reason, because only the failed boundaries clean claim decided that earlier verdict. Genie 1.0.2 printed (target_not_found) there, the reason of a refused claim that did not decide it.

After the fix (exit code 0):

pass vfy_1b8e75d7-5643-4883-b59b-8b92e3ad613d "reload profile"  2 commits, quiet after 616 ms (react, query, network)
  1 pass render ProfileDetails min 1  {renders:2,mounts:0,updates:2,remounts:0,semantics:exact,instances:1,activeInstances:1}
  2 pass boundaries clean  {caughtDuringWindow:0,caughtAtEnd:0}
attempt 3 for these claims on this tab; previous fail vfy_a075dbd1-c899-41c6-b6e8-60c641f836b8; document reloaded since

The history line counts this pass as attempt 3 on the same claims, after the two fails.

The card now reads Name Dana Whitfield, Email dana@example.com, Location Not provided.

The boundary still swallows the next error

The throw is gone, but CardBody still returns null for any future error. You do not need a new bug to see that. react_force_error_boundary puts the nearest boundary of a component into its error state:

npx genie-react call react_find_components '{"query":"ProfileDetails","exact":true}' --session upd-a
npx genie-react call react_force_error_boundary '{"id":1152544407573,"forceError":true}' --session upd-a
agent-browser --session upd-a get text '[aria-label=Profile]'

react_find_components returned one match, {id:1152544407573,name:ProfileDetails,path:"QueryClientProvider > App > AccountScreen > CardBody > ProfileDetails",…}. The force call and the card text:

ok: true
boundaryId: 1152544407572
boundaryName: CardBody
erroring: true
activeOverrides: 1
Profile

react_error_state now reports the forced error with forced: true and the same rendered: {output:nothing,hostNodes:0,text:null}. Release it with react_reset_overrides '{}', which returned remaining: 0.

Give the boundary a fallback that says something failed:

   render() {
-    return this.state.failed ? null : this.props.children
+    if (!this.state.failed) return this.props.children
+    return <p role="alert">This section failed to load.</p>
   }

Force the boundary again, and the user sees the failure:

npx genie-react call react_force_error_boundary '{"id":2493983490076,"forceError":true}' --session upd-a
agent-browser --session upd-a get text '[aria-label=Profile]'
npx genie-react call react_error_state '{"includeSource":false}' --session upd-a --select /caughtErrors/0/rendered
Profile

This section failed to load.
result: {output:visible,hostNodes:1,text:"This section failed to load."}

The component ID changed because the page reloaded after the edit. Find it again after every reload.

A visible fallback alone does not pass

With the fallback in place and the formatLocation fix reverted, the card shows "This section failed to load." The same verify run still fails with exit code 1:

fail vfy_dadc9188-be23-440d-bddf-145680a8e8cb "reload profile"  0 commits, quiet after 616 ms (react, query, network)
  1 refused render ProfileDetails min 1  target_not_found: No ProfileDetails instance was mounted at begin or rendered in the window; a target Genie cannot see is not a target that did nothing.
  2 fail boundaries clean  {caughtDuringWindow:0,caughtAtEnd:1}

boundaries clean checks whether a boundary caught, not what it showed. A good fallback makes a failure visible. It does not make the screen work. You need both changes.

When this approach does not fit

boundaries clean covers errors that React error boundaries catch. Its result carries the caveat uncaught-errors-outside-boundaries-unobserved, so an error with no boundary above it is outside the claim. Error boundaries also do not catch errors thrown in event handlers or in async code such as setTimeout callbacks (React docs). For those, the screen and the console are your evidence.

rendered.output reads the DOM below the boundary. React Native has no DOM, so there the tool reference says the field is unknown. This article did not test that case.

The error here fires on page load, so the verify run needs a second trigger such as query_reset to put React work inside the window. If your screen has a retry button or a route change that remounts the component, drive that instead. See Verify a fix for the claim syntax, and Validate UI states for forcing loading, empty and error states.

On this page