{"record":{"id":"85d53a86936488c1","repo":"apify/crawlee","slug":"errormessage-join","errorCode":null,"errorMessage":"${errorMessage.join('\n')}​","messagePattern":"\\$\\{errorMessage\\.join\\('\n'\\)\\}​","errorType":"exception","errorClass":"BrowserLaunchError","httpStatus":null,"severity":"error","filePath":"packages/browser-pool/src/abstract-classes/browser-plugin.ts","lineNumber":322,"sourceCode":"\n        if (executablePath) {\n            errorMessage.push(`- Check whether the provided executable path \"${executablePath}\" is correct.`);\n        }\n\n        if (process.env.APIFY_IS_AT_HOME) {\n            errorMessage.push(`- Make sure your Dockerfile extends ${dockerImage}.`);\n        }\n\n        errorMessage.push(`- ${moduleInstallCommand}`);\n\n        errorMessage.push(\n            '',\n            'The original error is available in the `cause` property. Below is the error received when trying to launch a browser:',\n            '',\n        );\n\n        // Add in a zero-width space so we can remove it later when printing the error stack\n        throw new BrowserLaunchError(`${errorMessage.join('\\n')}\\u200b`, { cause });\n    }\n\n    /**\n     * @private\n     */\n    protected abstract addProxyToLaunchOptions(\n        launchContext: LaunchContext<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>,\n    ): Promise<void>;\n\n    protected abstract isChromiumBasedBrowser(\n        launchContext: LaunchContext<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>,\n    ): boolean;\n\n    /**\n     * @private\n     */\n    protected abstract _launch(\n        launchContext: LaunchContext<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>,","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/apify/crawlee/blob/dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c/packages/browser-pool/src/abstract-classes/browser-plugin.ts#L304-L340","documentation":"throwAugmentedLaunchError builds a multi-line diagnostic report (launch options, proxy info, and the underlying launch error) and throws it as a single BrowserLaunchError whose message is the joined lines, terminated with a zero-width space used later when printing the stack. The real cause is in `error.cause`; the message is the augmented, human-readable launch failure report. Called when the plugin detects that its launch attempt failed (throwOnFailedLaunch) or directly from _launch paths.","triggerScenarios":"Any browser launch failure routed through the plugin's failure detection: missing/unsupported browser executable, incompatible browser version, invalid launch options, proxy misconfiguration, or the underlying library (Playwright/Puppeteer) rejecting launch().","commonSituations":"First run in an environment where the browser binary was never downloaded; Docker images without the needed system libraries; launch args rejected by a newer/older browser version; proxy env variables malformed.","solutions":["Read the full multi-line message — it contains the exact launch options and the original error text above the marker line.","Inspect error.cause for the raw error.","Install/download the correct browser executable (e.g. `npx playwright install chromium`).","Fix or remove invalid launchOptions/args and proxy configuration.","Check the zero-width space note: when matching on the message programmatically, strip the trailing \\u200b."],"exampleFix":"// before\n// message ends with an invisible zero-width space, exact string compare fails\nif (err.message === 'Failed to launch browser.') { ... }\n// after\nconst clean = err.message.replace(/\\u200b/g, '');\nif (clean.includes('Failed to launch')) {\n    console.error('launch report:', clean, '\\ncause:', err.cause);\n}","handlingStrategy":"try-catch","validationCode":"// pre-launch: ensure the browser binary exists\nimport { executablePath } from 'playwright';\nif (!existsSync(executablePath())) await run('npx playwright install chromium');","typeGuard":null,"tryCatchPattern":"try {\n    const page = await pool.newPage();\n} catch (err) {\n    if (err instanceof BrowserLaunchError) {\n        console.error(err.message.replace(/\\u200b/g, '')); // full launch report\n        console.error('root cause:', err.cause);\n    } else throw err;\n}","preventionTips":["Install browser binaries and OS deps in your image before running","Read the multi-line message; it contains launch options and the original error","Strip the trailing zero-width space before string-matching the message","Keep launchOptions/args and proxy config valid for your browser version"],"tags":["launch","browser-installation","diagnostics"],"backgroundTag":"browser-launch-failed","analyzedSha":"dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c","analyzedAt":"2026-08-30T22:22:28.328Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}