{"record":{"id":"716b2a6a47468cc4","repo":"firecrawl/open-lovable","slug":"scrape-data-is-missing","errorCode":null,"errorMessage":"Scrape data is missing","messagePattern":"Scrape data is missing","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/generation/page.tsx","lineNumber":2934,"sourceCode":"- src/index.css - Include brand fonts, custom shadows/effects, and base styling\n- src/App.jsx - Should ONLY render the requested component (e.g., just <PricingPage /> if user wants pricing)\n- src/components/[RequestedComponent].jsx - The actual component fulfilling the user's request\n\nTECHNICAL REQUIREMENTS:\n- Create a WORKING, self-contained application\n- DO NOT import components that don't exist\n- Make sure the app renders immediately with visible content\n- All colors must match the brand palette EXACTLY\n- All spacing must use the ${branding.spacing?.baseUnit || '4'}px base unit\n- Buttons must have the exact styling specified in the guidelines\n\nFocus on building something NEW, minimal, and functional that perfectly matches the ${brandGuidelines.styleName || 'brand'} aesthetic and design system.`;\n\n        } else {\n          // === NORMAL CLONE MODE PROMPT ===\n          // Store scraped data in conversation context\n          if (!scrapeData) {\n            throw new Error('Scrape data is missing');\n          }\n          setConversationContext(prev => ({\n            ...prev,\n            scrapedWebsites: [...prev.scrapedWebsites, {\n              url: url,\n              content: scrapeData,\n              timestamp: new Date()\n            }],\n            currentProject: `${url} Clone`\n          }));\n\n          // Filter out style-related context when using screenshot/URL-based generation\n          // Only keep user's explicit instructions, not inherited styles\n          let filteredContext = homeContextInput;\n          if (homeUrlInput && homeContextInput) {\n            // Check if the context contains default style names that shouldn't be inherited\n            const stylePatterns = [\n              'Glassmorphism style design',","sourceCodeStart":2916,"sourceCodeEnd":2952,"githubUrl":"https://github.com/firecrawl/open-lovable/blob/69bd93bae7a9c97ef989eb70aabe6797fb3dac89/app/generation/page.tsx#L2916-L2952","documentation":"Internal state guard thrown in normal clone mode just before building the generation prompt: scrapeData is null/undefined when the code tries to store it in conversationContext.scrapedWebsites. It means the clone flow reached the prompt-construction stage without a successful scrape result — typically the scrape step was skipped, failed silently upstream, or the variable was reset. This is a logic/state bug guard, not a network error.","triggerScenarios":"Entering clone-mode prompt building with !scrapeData: the scrape branch threw earlier but was caught and swallowed, the brand-extension branch ran but mode detection later treated it as clone mode, or scrapeData was never assigned due to a conditional path that bypassed the scraping step.","commonSituations":"User cancels or partially completes the scrape step then proceeds; mixed-mode URL flows where brandExtensionMode toggles after scrapeData initialization; component re-render/state reset clearing scrapeData between steps; earlier scrape error caught by an outer try/catch that only logged, letting execution continue.","solutions":["Ensure the scrape step runs and assigns scrapeData before the prompt-building branch — throw or abort early if the scrape failed instead of continuing","Make the outer catch on the scrape step return/abort the flow rather than fall through to prompt construction","Verify brandExtensionMode vs clone-mode branching: scrapeData is only set in clone mode, so clone mode must re-run the scrape if missing","Check for state resets (re-renders, key changes) that clear scrapeData between the scrape and generate steps"],"exampleFix":"// before\nif (!scrapeData) {\n  throw new Error('Scrape data is missing');\n}\n// after\nif (!scrapeData) {\n  addChatMessage('No scraped content available. Re-running the scrape...', 'system');\n  scrapeData = await scrapeWebsite(url); // retry the scrape before failing\n  if (!scrapeData) throw new Error('Scrape data is missing');\n}","handlingStrategy":"validation","validationCode":"// before entering prompt construction in clone mode\nif (brandExtensionMode) {\n  if (!brandGuidelines) throw new Error('Brand guidelines are missing');\n} else {\n  if (!scrapeData) throw new Error('Scrape data is missing — run the scrape step first');\n}","typeGuard":"function hasScrapeData(d: ScrapeData | null | undefined): d is ScrapeData & { success: true } {\n  return d !== null && d !== undefined && d.success === true;\n}","tryCatchPattern":"try {\n  if (!hasScrapeData(scrapeData)) {\n    throw new Error('Scrape data is missing');\n  }\n  setConversationContext(prev => ({ ...prev, scrapedWebsites: [...prev.scrapedWebsites, { url, content: scrapeData }] }));\n} catch (err: any) {\n  addChatMessage(`Cannot generate: ${err.message}. Please scrape the site first.`, 'system');\n  return; // abort the flow instead of continuing with missing state\n}","preventionTips":["Abort the flow (return/throw out of the handler) when a prerequisite step fails instead of falling through","Keep scrapeData and mode flags (brandExtensionMode) in sync — derive one from the other where possible","Guard both branches: brand mode needs brandGuidelines, clone mode needs scrapeData","Avoid resetting state between scrape and generate steps (stable component keys, single flow function)","Add an assertion/log when scrapeData is unexpectedly null to catch silent upstream failures"],"tags":["state","logic","scraping","invariant"],"backgroundTag":"missing-required-state","analyzedSha":"69bd93bae7a9c97ef989eb70aabe6797fb3dac89","analyzedAt":"2026-08-28T22:20:32.339Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}