From e374660cd30822f6e92d8bf8037e3195b5257d5c Mon Sep 17 00:00:00 2001 From: Abimael Martell Date: Fri, 30 Jan 2026 15:22:34 -0800 Subject: [PATCH] fix(branding): improve error messages for PDFs and documents (#2776) Show user-friendly error messages when branding extraction is requested for PDFs or documents, explaining that branding is only supported for HTML web pages. Keep the technical error message for other cases like forced engines or self-hosted environments without fire-engine. Co-authored-by: Claude Opus 4.5 --- apps/api/src/scraper/scrapeURL/engines/index.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/api/src/scraper/scrapeURL/engines/index.ts b/apps/api/src/scraper/scrapeURL/engines/index.ts index e9197ec47..7a897cc1b 100644 --- a/apps/api/src/scraper/scrapeURL/engines/index.ts +++ b/apps/api/src/scraper/scrapeURL/engines/index.ts @@ -609,9 +609,16 @@ export async function buildFallbackList(meta: Meta): Promise< f => !f.unsupportedFeatures.has("branding"), ); if (!hasCDPEngine) { - throw new Error( - "Branding extraction requires Chrome CDP (fire-engine). ", - ); + if (meta.featureFlags.has("pdf")) { + throw new Error( + "Branding extraction is only supported for HTML web pages. PDFs are not supported.", + ); + } else if (meta.featureFlags.has("document")) { + throw new Error( + "Branding extraction is only supported for HTML web pages. Documents (docx, xlsx, etc.) are not supported.", + ); + } + throw new Error("Branding extraction requires Chrome CDP (fire-engine)."); } }