#6 most commonruntime/UILovableBolt.newCursorReplitv0Windsurf

TypeError: Cannot read properties of undefined (or null)

Uncaught TypeError: Cannot read properties of undefined (reading 'map')

Got a slightly different error? Paste the exact message and get a fix prompt tailored to it.

Paste your error →

What it means

The code tried to use a piece of data before it existed, like reading a list before it finished loading from the database. It's like opening a box that hasn't been delivered yet.

How to fix it: paste this prompt into your AI builder

Fix prompt for Lovable, Bolt, Cursor, Replit, v0, Windsurf
I'm getting "Cannot read properties of undefined/null". Find the exact line from the stack trace and the variable that is undefined. Fix it by handling the loading and empty states properly: give the state a safe default (e.g. [] for lists, null plus a loading check for objects), use optional chaining where data may be missing, and show a loading or 'no data yet' message instead of crashing. Also check whether the data shape changed (e.g. the API returns { data: [...] } but the code expects an array). Only change the component(s) involved; do not refactor unrelated code.

If the AI can't fix it: manual steps

  1. The error message says what it was trying to read, e.g. (reading 'map') means a list was missing. Search your code for that word.
  2. Check that the database table actually has rows and that you're logged in, since empty or blocked data often causes this.

Where this happens

Seen in these AI app builders and editors:

LovableBolt.newCursorReplitv0Windsurf

Sources

Related runtime/UI errors

Still stuck? Paste your full error and UnstuckMyVibe will match it and hand you the exact fix prompt.

Fix my error →