Blank screens & build errors

Diagnose white screens, missing imports, and failed production builds fast — without burning credits on circular fixes or taking your live app offline.

Why blank screens and build errors happen

Nearly every blank white screen or red error banner originates in one of three boundaries: compile time, browser runtime, or production Publish bundling. Pinpointing the boundary first prevents costly blind rewrites.

At compile time, a syntax typo, TypeScript mismatch, or missing package stops the bundle from building, showing a red banner in Preview. At browser runtime, compilation passes, yet an uncaught JavaScript exception unmounts the UI tree into a blank canvas.

At Publish time, stricter production checks run before updating your live domain. Because Preview and Live stay strictly isolated, a Preview error never takes live visitors offline unless you actively publish a regression. See Preview vs Live.

Triage matrix: match the symptom to the layer

Start every debugging session by matching what you observe on screen to the exact failure boundary below.

SymptomFailure layerMost common causeFastest first action
Red banner in Preview with file and line numberCompile / buildSyntax error, TypeScript mismatch, or wrong import nameClick Ask AI to fix once so the Agent reads the exact log
Completely white Preview with no red bannerBrowser runtimeUncaught TypeError during render or bad API JSON payloadOpen Browser DevTools Console and paste the top red error into chat
Screen loads, then turns blank after a clickInteractive runtimeForm handler or modal reads an undefined state fieldReproduce with Console open and share the exact click path plus trace
Preview works fine, Publish build failsProduction buildStrict type check or server-only module imported in browser codeClick Ask AI to fix from the Publish error banner, then re-publish
Infinite loading spinner on one pageData fetch / APIBackend endpoint returned 500 or hung without clearing loading stateCheck DevTools Network tab for red responses and inspect error body
Live site turned blank right after PublishLive runtimeRuntime crash triggered only on Live data or missing Live configRoll back to the previous stable release in Publish first

Reading browser console errors like an engineer

When Preview renders a solid white screen without a build banner, the browser already knows the exact line that crashed. Opening DevTools takes two seconds and turns a vague symptom into a one-turn fix.

Press Cmd + Option + J on macOS or Ctrl + Shift + J on Windows to open the Console tab, then refresh the failing route. Filter strictly to Errors (red icons) so third-party browser extension warnings do not distract you.

Look at the top three lines of the first red exception — you rarely need the full 40-line stack trace. Also open the Network tab, filter by Fetch/XHR, and check for any request returning HTTP 404, 500, or 200 with HTML instead of JSON.

text
What to copy into ExaSpark chat (high signal)
------------------------------------------------------------------
Route: /dashboard/bookings (Preview, signed in as Member)
Console error:
  Uncaught TypeError: Cannot read properties of undefined (reading 'map')
  at BookingList (src/pages/DashboardBookings.tsx:48:21)
Network tab:
  GET /api/bookings -> 500 Internal Server Error
  Response body: {"error":"column \"slot_time\" does not exist"}

What to ignore (noise)
------------------------------------------------------------------
- Chrome extension warnings (chrome-extension://...)
- Harmless DevTools source-map notices
- Repeated downstream React warnings after the first uncaught error

Notice how combining the Console error with the Network response immediately exposes the true root cause: the frontend crashed calling .map() only because /api/bookings returned a 500 error after a renamed database column. Fixing only the frontend null check would have hidden a broken query.

Fixing missing packages, imports, and broken refactors

Three recurring code patterns explain most build and runtime crashes during multi-turn iteration.

Missing modules and mismatched exports

Errors like Cannot find module 'lucide-react' or does not provide an export named 'BookingCard' happen when a file imports an uninstalled package or mixes default (export default) and named (export function) exports. Click Ask AI to fix or paste the exact line to install or align the import cleanly.

Schema renames that break UI screens

Renaming a Cloud column (such as slot_time to starts_at) breaks queries, forms, and tables still referencing the old name. Always update queries, TypeScript types, forms, and Cloud definitions together in one dedicated turn. See Safe schema migrations.

Server-only code imported in browser components

If a React component accidentally imports a server database client or secret helper, Publish rejects the production bundle. Keep database queries and secrets inside backend API routes, and call them from the browser via fetch.

Using Ask AI to fix vs rolling back with Undo

Knowing when to repair forward versus revert stops circular debugging and saves credits.

SituationRecommended toolWhy it works best
First red build banner after an editAsk AI to fixPasses exact compiler logs directly to the Agent for a surgical fix
Clear console trace on one screenTargeted chat promptPasting route, console trace, and Network body fixes root cause in 1 turn
Two fix attempts failed or cascadedUndo to green checkpointStops tangled context from compounding across files
Experimental redesign broke navigationUndo immediatelyFaster to restart from verified state with a narrower prompt
Live route crashing for real visitorsPublish rollback, then PreviewRestores live access in seconds before you diagnose

Follow this five-step recovery loop whenever a build or screen breaks:

  1. Protect Live first

    If visitors see errors, roll back Live from Publish history before debugging in Preview.

  2. Use Ask AI to fix once

    On red compile or Publish banners, click Ask AI to fix so the Agent reads the exact log.

  3. Capture Console and Network facts

    On silent white screens, copy the top red console error plus any failed API response.

  4. Stop at two failed fixes

    If two repair turns stall, click Undo back to your last verified green checkpoint.

  5. Replay smaller steps

    Update the backend route first, confirm Preview stays green, then wire the UI screen.

Read Breaking fix loops and Checkpoints & Undo for larger recovery patterns.

High-signal prompts that fix crashes cleanly

Avoid vague prompts like "the page is blank, fix it." Paste the exact failing route, console trace, and safety guardrail so the Agent resolves both the immediate crash and its fragile assumptions.

Use this prompt when a runtime exception blanks out a screen:

Starter prompt · App

On /dashboard/bookings in Preview (signed in as a Member), the screen turns blank. Browser Console shows `TypeError: Cannot read properties of undefined (reading 'map')` at `DashboardBookings.tsx:48`, and `GET /api/bookings` returns 500 with `column "slot_time" does not exist`. Align the backend query and frontend types to the current `starts_at` column, default missing lists safely to `[]`, and wrap dashboard routes in a clean error boundary showing a Retry button instead of a white screen.

Use this prompt when Preview loads normally but Publish fails during production bundling:

Starter prompt · App

Preview loads normally, but Publish fails during production build with a TypeScript and bundle error referencing a server helper imported inside `src/components/InvoiceDownload.tsx`. Move the server-only logic behind a dedicated `/api/invoices/:id/download` backend route, call it cleanly from the button click handler, run a strict production type check, and confirm no server-only modules remain in frontend components.

Preventing recurring blank screens

Four lightweight engineering habits eliminate most blank screens before they ever reach customers:

  • Add route-level error boundaries. Ask the Agent to wrap main layouts in an error boundary that displays a calm message and Reload button if an unexpected runtime error occurs.
  • Always code three UI states. Every data-driven screen needs explicit loading, empty, and error states so an empty table or temporary network blip never crashes .map() or renders dead white space.
  • Separate schema edits from visual overhauls. Change database columns in one clean turn, verify Preview loads green, and run styling polish in a separate turn so Undo stays surgical.
  • Check Console once before Publish. Click through your primary visitor and member flows with DevTools Console open for thirty seconds before shipping a release to Live.

Next steps

Still have a question?Ask our team and other builders on Discord.

From the blog