{"record":{"id":"b493e27bed8cae9a","repo":"firecrawl/open-lovable","slug":"screenshot-not-available-in-response-check-conso","errorCode":null,"errorMessage":"Screenshot not available in response - check console for full response structure","messagePattern":"Screenshot not available in response - check console for full response structure","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"app/api/scrape-screenshot/route.ts","lineNumber":68,"sourceCode":"        success: true,\n        screenshot: scrapeResult.screenshot,\n        metadata: scrapeResult.metadata || {}\n      });\n    } else if ((scrapeResult as any)?.data?.screenshot) {\n      // Nested data structure\n      return NextResponse.json({\n        success: true,\n        screenshot: (scrapeResult as any).data.screenshot,\n        metadata: (scrapeResult as any).data.metadata || {}\n      });\n    } else if ((scrapeResult as any)?.success === false) {\n      // Explicit failure\n      console.error('[scrape-screenshot] Firecrawl API error:', (scrapeResult as any).error);\n      throw new Error((scrapeResult as any).error || 'Failed to capture screenshot');\n    } else {\n      // No screenshot in response\n      console.error('[scrape-screenshot] No screenshot in response. Full response:', JSON.stringify(scrapeResult, null, 2));\n      throw new Error('Screenshot not available in response - check console for full response structure');\n    }\n\n  } catch (error: any) {\n    console.error('[scrape-screenshot] Screenshot capture error:', error);\n    console.error('[scrape-screenshot] Error stack:', error.stack);\n    \n    // Provide fallback response for development - removed NODE_ENV check as it doesn't work in Next.js production builds\n    \n    return NextResponse.json({ \n      error: error.message || 'Failed to capture screenshot'\n    }, { status: 500 });\n  }\n}","sourceCodeStart":50,"sourceCodeEnd":81,"githubUrl":"https://github.com/firecrawl/open-lovable/blob/69bd93bae7a9c97ef989eb70aabe6797fb3dac89/app/api/scrape-screenshot/route.ts#L50-L81","documentation":"Thrown when Firecrawl reports success (HTTP ok, success not false) but the response contains no `data.screenshot` field. The full response is logged server-side; the message tells the developer the scrape worked but the requested screenshot output is missing — usually because screenshot capture wasn't requested or the page rendered nothing.","triggerScenarios":"POST /api/scrape-screenshot where scrapeResult.success is true but `data.screenshot` is undefined: the scrape request omitted/failed the screenshot format, Firecrawl skipped capture for the page type, or the v1 endpoint was used without `formats: ['screenshot']`.","commonSituations":"Calling the scrape endpoint without `formats: ['screenshot']` in the body; scraping PDFs or pages Firecrawl can't render; response schema differences between Firecrawl v1/v2 clients; stale SDK returning a different payload nesting.","solutions":["Check the server console for 'No screenshot in response. Full response:' and inspect the payload structure","Ensure the Firecrawl request body explicitly includes the screenshot format (e.g. `formats: ['screenshot']` for v2)","Verify the target URL is a renderable public web page (not a PDF, download, or auth-gated page)","Handle `fullPage`/screenshot options per the installed SDK version and add a fallback message with the returned formats"],"exampleFix":"// before\nconst scrapeResult = await app.scrapeUrl(url, {});\n// after\nconst scrapeResult = await app.scrapeUrl(url, { formats: ['screenshot', 'metadata'] });","handlingStrategy":"validation","validationCode":"if (!scrapeResult?.data?.screenshot) {\n  throw new Error(`No screenshot returned. formats received: ${Object.keys(scrapeResult?.data || {})}`);\n}","typeGuard":"function hasScreenshot(r: any): r is { data: { screenshot: string } } {\n  return typeof r?.data?.screenshot === 'string' && r.data.screenshot.length > 0;\n}","tryCatchPattern":"try {\n  return await captureScreenshot(url);\n} catch (e) {\n  if (e.message.startsWith('Screenshot not available')) {\n    // check logged response structure; ensure formats includes 'screenshot' and retry\n    return captureScreenshotWithExplicitFormats(url);\n  }\n  throw e;\n}","preventionTips":["Always request the screenshot format explicitly in the scrape options (v2: formats: ['screenshot'])","Verify the target page is a renderable public web page (not PDF/download/login-gated)","Check the logged response structure after any Firecrawl SDK or API version bump","Type-check/validate the response payload before accessing data.screenshot"],"tags":["firecrawl","screenshot","response-shape","third-party-api"],"backgroundTag":"unexpected-response-shape","analyzedSha":"69bd93bae7a9c97ef989eb70aabe6797fb3dac89","analyzedAt":"2026-08-28T22:20:32.339Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}