Skip to main content
A guide to common error messages and their solutions.

Build Errors

Module not found

Cause: The imported file doesn’t exist or path is wrong. Fix:

Unexpected token

Cause: JavaScript syntax error, often in JSX. Fix:

Type error

Cause: TypeScript type mismatch. Fix:

Export not found

Cause: Component exists but isn’t exported. Fix:

Runtime Errors

Cannot read properties of undefined

Cause: Trying to use a method on undefined/null value. Fix:

X is not a function

Cause: Variable isn’t what you expect. Fix:

Network error

Cause: API request failed (network, CORS, or server error). Fix:

React Island Errors

These happen inside interactive React components (islands) on your Astro site.

Hydration mismatch

Cause: The static HTML and the hydrated island render different content. Fix:
Common causes:
  • Using Date.now() or Math.random() directly
  • Accessing window or localStorage without checks
  • Conditional rendering based on browser-only values

Invalid hook call

Cause: Hook used incorrectly. Fix:

Too many re-renders

Cause: Component is in infinite render loop. Fix:
Usually caused by:
  • Calling setState directly in render
  • Missing dependency array in useEffect
  • State update triggering another state update

Database Errors

Permission denied on a row

Cause: Data is scoped per user, and this operation isn’t permitted for the signed-in user. Fix:

Foreign key violation

Cause: Referenced record doesn’t exist. Fix:

Duplicate key

Cause: Trying to insert duplicate value in unique column. Fix:

Authentication Errors

Session not found

Cause: User not logged in or session expired. Fix:

Invalid login credentials

Cause: Wrong email or password. Fix: This is expected for wrong credentials. Ensure your error handling shows a user-friendly message.

Environment Variable Errors

Missing environment variable

Cause: Required variable not set. (In Astro, browser-exposed variables are prefixed with PUBLIC_.) Fix:
  1. Go to Settings > Environment
  2. Add the missing variable
  3. Redeploy if in production

Quick Reference Table

Error ContainsLikely CauseQuick Fix
Cannot find moduleWrong importCheck file path
undefinedMissing dataAdd null check
not a functionWrong variable typeCheck variable
HydrationServer/client mismatchFix SSR
Invalid hookHook misuseCheck hook rules
Too many re-rendersInfinite loopFix useEffect/setState
not allowedPer-user data ruleCheck table access rules
Failed to fetchNetwork/API issueCheck endpoint
PUBLIC_Env var missingAdd to settings

Getting More Help

If an error isn’t listed here:
  1. Copy the full error message
  2. Paste it to Kleap AI with context about what you were doing
  3. Check browser console for additional details

Troubleshooting Guide

Step-by-step solutions to common problems