Lovable provides error logs in three places: the browser console (press F12 in the preview), the Cloud tab Logs section for Supabase Edge Function output, and inline error messages in the preview panel itself. The Try-to-fix button that appears on preview errors costs no credits and should be your first action. For deeper debugging, use Plan Mode to analyze error logs without modifying code — it can read files, inspect logs, and trace the root cause for one credit.
Why understanding error logs matters in Lovable
When something breaks in a Lovable project, the error log is the fastest path to a fix. But many non-technical users see a wall of red text in the browser console and have no idea what it means. This leads to vague prompts like 'fix the error' which waste credits because the AI has to guess what went wrong. Lovable surfaces errors in multiple places depending on where the problem originates. Frontend errors (React component crashes, undefined variables, failed API calls) appear in the browser console and sometimes as a red error overlay in the preview panel. Backend errors (Edge Function failures, database query errors, auth issues) appear in the Cloud tab under Logs. Understanding which log to check saves significant debugging time. The preview panel also has a built-in Try-to-fix button that appears automatically when errors are detected. This button is free — it does not cost credits — and should always be your first action before manually prompting the AI. Many simple errors are resolved automatically by this feature.
- Frontend runtime errors — React component crashes, undefined variables, failed imports
- Supabase Edge Function errors — server-side code throwing exceptions visible only in Cloud logs
- Build errors — TypeScript type mismatches and import resolution failures during compilation
- Network errors — failed API calls, CORS blocks, and timeout errors visible in the browser console Network tab
- Authentication errors — session expiry, invalid tokens, and RLS policy violations logged in both console and Supabase logs
Error messages you might see
Uncaught TypeError: Cannot read properties of undefined (reading 'map')A component is trying to call .map() on a variable that is undefined. This usually means an API response has not loaded yet, or the data structure is different from what the code expects. Add a loading check or optional chaining before the .map() call.
Error: 500 Internal Server Error at /functions/v1/your-function-nameA Supabase Edge Function crashed. Check the Cloud tab, then Logs for the full error output including stack trace. Common causes are missing environment variables, invalid SQL queries, or unhandled exceptions in the function code.
Failed to compile: Module not found: Can't resolve './components/SomeComponent'The build system cannot find a file that is imported in your code. Either the file was deleted, renamed, or the import path has a typo. Check that the file exists at the exact path specified in the import statement.
AuthApiError: Invalid login credentialsThe email and password combination does not match any user in Supabase Auth. This appears in both the browser console and Supabase Auth logs. Verify the user exists and the password is correct.
Before you start
- A Lovable project open in the editor
- Access to the browser developer tools (F12 or right-click, then Inspect)
- A Lovable Cloud project for accessing Edge Function logs
- Basic understanding of what error messages mean (this guide will help)
How to fix it
Check the preview panel for inline errors and the Try-to-fix button
The preview panel catches many errors automatically and offers a free fix attempt
Check the preview panel for inline errors and the Try-to-fix button
The preview panel catches many errors automatically and offers a free fix attempt
Look at the live preview panel in the Lovable editor. When a React error occurs, you will see either a red error overlay with a stack trace or a blank white screen. If Lovable detects the error, a Try-to-fix button appears. Click it — this costs no credits and resolves many common issues automatically. If the button does not appear or the fix does not work, proceed to check the browser console for more details.
Expected result: Either the Try-to-fix button resolves the error automatically, or you have identified that you need to check the browser console for more information.
Open the browser console to read frontend error logs
The browser console shows the exact error message, file, and line number for frontend issues
Open the browser console to read frontend error logs
The browser console shows the exact error message, file, and line number for frontend issues
Right-click anywhere in the Lovable preview panel and select Inspect (or press F12). Click the Console tab in the developer tools panel that opens. Look for red error messages — these are the actual errors causing the problem. Each error shows the message, the file name, and the line number. Copy the exact error text, including the file path. You can paste this directly into a Lovable prompt for a targeted fix: 'Fix this error in @src/components/Dashboard.tsx: TypeError: Cannot read properties of undefined (reading map) at line 24.'
// Vague prompt that wastes credits// "My app is broken, please fix it"// The AI guesses and may change the wrong files// Specific prompt using the exact error from the console// "Fix this error in @src/components/Dashboard.tsx:// TypeError: Cannot read properties of undefined (reading 'map') at line 24.// The 'users' variable is undefined when the component first renders.// Add a loading state that shows while the data is being fetched."// The AI knows exactly what file, what line, and what to fixExpected result: You can see the exact error message, file name, and line number. Use this information to write a precise prompt for the AI.
Check Cloud tab Logs for Edge Function errors
Server-side errors from Supabase Edge Functions are only visible in Cloud logs, not in the browser console
Check Cloud tab Logs for Edge Function errors
Server-side errors from Supabase Edge Functions are only visible in Cloud logs, not in the browser console
Click the + button next to Preview to open additional panels, then select Cloud tab. Navigate to Logs. Here you will see output from your Supabase Edge Functions, including console.log statements, error messages, and stack traces. Filter by function name if you have multiple functions. Look for lines that say 'error' or show HTTP 500 status codes. These logs also show the request payload that triggered the error, which helps you reproduce and fix the issue.
// Edge Function with no error logging — failures are invisibleimport { serve } from "https://deno.land/std@0.168.0/http/server.ts";serve(async (req) => { const { userId } = await req.json(); const result = await someOperation(userId); return new Response(JSON.stringify(result));});// Edge Function with proper error logging — failures are visible in Cloud Logsimport { serve } from "https://deno.land/std@0.168.0/http/server.ts";serve(async (req) => { try { const { userId } = await req.json(); console.log("Processing request for user:", userId); const result = await someOperation(userId); console.log("Operation successful"); return new Response(JSON.stringify(result), { headers: { "Content-Type": "application/json" }, }); } catch (error) { // This message appears in Cloud tab → Logs console.error("Edge Function error:", error.message, error.stack); return new Response( JSON.stringify({ error: error.message }), { status: 500, headers: { "Content-Type": "application/json" } } ); }});Expected result: Edge Function errors now appear with full details in Cloud tab Logs, including the error message, stack trace, and which request triggered it.
Use Plan Mode to analyze errors without modifying code
Plan Mode can read files, inspect logs, and trace root causes for one credit without risking further breakage
Use Plan Mode to analyze errors without modifying code
Plan Mode can read files, inspect logs, and trace root causes for one credit without risking further breakage
Switch to Plan Mode (click the mode toggle above the chat input). Paste the error message and ask Plan Mode to analyze it: 'I see this error in the browser console: [paste error]. Which file is causing this, what is the root cause, and what is the minimal fix?' Plan Mode will search through your project files, trace the error to its source, and propose a fix without actually changing any code. Review its analysis, then switch back to Agent Mode to implement only the changes you approve. If the error spans multiple generated components across your project, RapidDev's engineers can trace and fix it quickly — they have debugged this pattern across 600+ Lovable projects.
Expected result: Plan Mode identifies the root cause file and line, explains why the error occurs, and proposes a minimal fix you can review before implementing.
Complete code example
1import { Component, ErrorInfo, ReactNode } from "react";23interface Props {4 children: ReactNode;5}67interface State {8 hasError: boolean;9 error: Error | null;10 errorInfo: ErrorInfo | null;11}1213export default class ErrorBoundary extends Component<Props, State> {14 constructor(props: Props) {15 super(props);16 this.state = { hasError: false, error: null, errorInfo: null };17 }1819 static getDerivedStateFromError(error: Error): Partial<State> {20 return { hasError: true, error };21 }2223 componentDidCatch(error: Error, errorInfo: ErrorInfo) {24 this.setState({ errorInfo });25 // Log error details to help with debugging26 console.error("ErrorBoundary caught:", error.message);27 console.error("Component stack:", errorInfo.componentStack);28 }2930 render() {31 if (this.state.hasError) {32 return (33 <div className="p-6 max-w-lg mx-auto mt-10 bg-red-50 border border-red-200 rounded-lg">34 <h2 className="text-lg font-semibold text-red-800 mb-2">35 Something went wrong36 </h2>37 <p className="text-sm text-red-700 mb-4">38 {this.state.error?.message}39 </p>40 <details className="text-xs text-red-600">41 <summary className="cursor-pointer">Error details (for debugging)</summary>42 <pre className="mt-2 whitespace-pre-wrap overflow-x-auto">43 {this.state.errorInfo?.componentStack}44 </pre>45 </details>46 <button47 onClick={() => this.setState({ hasError: false, error: null, errorInfo: null })}48 className="mt-4 px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700"49 >50 Try again51 </button>52 </div>53 );54 }5556 return this.props.children;57 }58}Best practices to prevent this
- Always click the Try-to-fix button first when it appears in the preview — it costs no credits and fixes many common errors
- Copy the exact error message from the browser console and paste it into your prompt — vague descriptions like 'it is broken' waste credits
- Use Plan Mode to analyze errors before using Agent Mode to fix them — analysis costs one credit, while a wrong fix attempt can cost many more
- Add an ErrorBoundary component to wrap your main app — it catches React crashes and shows useful error details instead of a blank screen
- Add console.error logging to all Edge Functions so failures are visible in Cloud tab Logs
- Check the Network tab in browser dev tools for failed API calls — look for red rows with 4xx or 5xx status codes
- Reference the specific file and line number in your fix prompts using @ syntax: '@src/components/File.tsx fix the error on line 24'
- For recurring errors, add the error pattern to AGENTS.md so the AI handles it correctly in future tasks
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I have a Lovable (lovable.dev) project and I see this error in the browser console: [Paste the exact error message, including file path and line number] Here is the code from the file mentioned in the error: [Paste the relevant file contents] Here is what I was trying to do when the error appeared: [Describe what you clicked or what page you navigated to] Please: 1. Explain what this error means in plain language 2. Identify the exact line causing the problem 3. Show me the corrected code 4. Suggest how to prevent this error from happening again
I see this error in the browser console: [paste exact error message including file path]. Please use Plan Mode to analyze this error. Tell me: 1) Which file and line is causing the error. 2) What the root cause is. 3) What is the minimal change needed to fix it. Do not modify any code yet — just analyze and explain.
Frequently asked questions
Where are error logs in Lovable?
Lovable shows errors in three places: the preview panel (inline error overlays with a Try-to-fix button), the browser console (press F12, then click Console tab), and the Cloud tab under Logs (for Supabase Edge Function output). Frontend errors appear in the first two; backend errors appear in Cloud Logs.
How do I open the browser console in the Lovable preview?
Right-click anywhere in the Lovable preview panel and select Inspect, or press F12 on your keyboard. Click the Console tab in the developer tools panel that appears. Red text indicates errors. You can also use the Network tab to see failed API requests.
What does 'Cannot read properties of undefined' mean?
This means your code is trying to access a property on a variable that does not exist yet. In Lovable projects, this most commonly happens when a component renders before API data has loaded. The fix is to add a loading check: if the data is undefined, show a loading spinner instead of trying to render it.
Does the Try-to-fix button cost credits?
No. The Try-to-fix button that appears on preview errors is free. It is always worth clicking before writing a manual prompt. If it does not resolve the issue, you can then write a more targeted prompt using the error details from the browser console.
How do I check Supabase Edge Function logs in Lovable?
Click the + button next to Preview to open additional panels, then select Cloud tab. Navigate to Logs. You will see output from all your Edge Functions, including console.log and console.error statements. Filter by function name to find errors from a specific function.
Why should I use Plan Mode for debugging?
Plan Mode can read your files, inspect logs, and trace the root cause of errors without modifying any code. It costs exactly one credit per message. This is much cheaper than letting Agent Mode attempt a fix that might introduce new bugs and cost additional credits to undo.
What if I can't understand the error logs myself?
If the error involves complex interactions between multiple generated files, database queries, and authentication logic, RapidDev's engineers can help. They specialize in debugging Lovable projects and can trace even cryptic error logs to their root cause across 600+ project patterns.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your issue.
Book a free consultation