firecrawl/open-lovable · error · Error

No branding data in Firecrawl response

Error message

No branding data in Firecrawl response

What it means

Thrown when Firecrawl returns HTTP 200 but the parsed JSON contains no `data.branding` (or top-level `branding`) object — i.e. the scrape succeeded but branding extraction produced nothing, or the response shape differs from the expected v2 schema (e.g. wrong API version or formats not requested).

Source

Thrown at app/api/extract-brand-styles/route.ts:49

      }),
    });

    if (!firecrawlResponse.ok) {
      const errorText = await firecrawlResponse.text();
      console.error('[extract-brand-styles] Firecrawl API error:', firecrawlResponse.status, errorText);
      throw new Error(`Firecrawl API returned ${firecrawlResponse.status}`);
    }

    const firecrawlData = await firecrawlResponse.json();
    console.log('[extract-brand-styles] Firecrawl response received successfully');

    // Extract branding data from response
    const brandingData = firecrawlData.data?.branding || firecrawlData.branding;

    if (!brandingData) {
      console.error('[extract-brand-styles] No branding data in Firecrawl response');
      console.log('[extract-brand-styles] Response structure:', JSON.stringify(firecrawlData, null, 2));
      throw new Error('No branding data in Firecrawl response');
    }

    console.log('[extract-brand-styles] Successfully extracted branding data');

    // Return the branding data
    return NextResponse.json({
      success: true,
      url,
      styleName: brandingData.name || url,
      guidelines: brandingData,
    });

  } catch (error) {
    console.error('[extract-brand-styles] Error occurred:', error);
    return NextResponse.json(
      {
        success: false,
        error: error instanceof Error ? error.message : 'Failed to extract brand styles'

View on GitHub (pinned to 69bd93bae7)

Solutions

  1. Inspect the server console log 'Response structure' to see the actual payload shape
  2. Confirm the request targets https://api.firecrawl.dev/v2/scrape and requests branding extraction in the scrape options
  3. Test with a branding-rich site (e.g. stripe.com) to rule out site-specific absence of branding data
  4. Add a fallback/defaults object so the route degrades gracefully instead of throwing when branding is absent

Example fix

// before
if (!brandingData) {
  throw new Error('No branding data in Firecrawl response');
}
// after
const brandingData = firecrawlData.data?.branding || firecrawlData.branding || {
  colors: { primary: '#000000' },
  fonts: { body: 'system-ui' },
  warning: 'No branding detected; using defaults'
};
Defensive patterns

Strategy: fallback

Validate before calling

const hasBranding = (d) => Boolean(d?.data?.branding || d?.branding);
if (firecrawlData && !hasBranding(firecrawlData)) console.warn('Firecrawl returned no branding; defaults will be used');

Type guard

function hasBrandingData(d: any): d is { data?: { branding: object } } & { branding?: object } {
  return Boolean(d?.data?.branding || d?.branding);
}

Try / catch

try {
  return await extractBrandStyles(url);
} catch (e) {
  if (e.message === 'No branding data in Firecrawl response') {
    return DEFAULT_BRAND_STYLES; // degrade gracefully
  }
  throw e;
}

Prevention

When it happens

Trigger: POST /api/extract-brand-styles where the scraped site has no detectable branding (no logo, colors, fonts), the scrape returned only markdown/html because `formats` didn't include branding output, or the endpoint used returns a v1-shaped payload.

Common situations: Scraping SPAs or login-walled pages where content never renders; calling the v1 scrape endpoint instead of the branding-aware v2 endpoint; forgetting `formats: ['branding']`-style options in the request body.

Related errors


AI-assisted analysis of firecrawl/open-lovable@69bd93bae7 (2026-08-28). Data as JSON: /api/errors/dc102f81163779a7. Report an issue: GitHub.