{"record":{"id":"5f79201b54a8d8f0","repo":"apify/crawlee","slug":"browser-plugin-at-index-i-providedpluginname","errorCode":null,"errorMessage":"Browser plugin at index ${i} (${providedPluginName}) is not an instance of the same plugin as the first plugin provided (${firstPluginName}).","messagePattern":"Browser plugin at index (.+?) \\((.+?)\\) is not an instance of the same plugin as the first plugin provided \\((.+?)\\)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/browser-pool/src/browser-pool.ts","lineNumber":397,"sourceCode":"            postLaunchHooks,\n            prePageCreateHooks,\n            postPageCreateHooks,\n            prePageCloseHooks,\n            postPageCloseHooks,\n            useFingerprints,\n            fingerprintOptions,\n        } = parseArgument(options, browserPoolOptionsSchema);\n\n        const firstPluginConstructor = browserPlugins[0].constructor as typeof BrowserPlugin;\n\n        for (let i = 1; i < browserPlugins.length; i++) {\n            const providedPlugin = browserPlugins[i];\n\n            if (!(providedPlugin instanceof firstPluginConstructor)) {\n                const firstPluginName = firstPluginConstructor.name;\n                const providedPluginName = (providedPlugin as BrowserPlugin).constructor.name;\n\n                throw new Error(\n                    `Browser plugin at index ${i} (${providedPluginName}) is not an instance of the same plugin as the first plugin provided (${firstPluginName}).`,\n                );\n            }\n        }\n\n        this.browserPlugins = browserPlugins as unknown as BrowserPlugins;\n        this.maxOpenPagesPerBrowser = maxOpenPagesPerBrowser;\n        this.maxOpenBrowsers = Infinity;\n        this.retireBrowserAfterPageCount = retireBrowserAfterPageCount;\n        this.operationTimeoutMillis = operationTimeoutSecs * 1000;\n        this.closeInactiveBrowserAfterMillis = closeInactiveBrowserAfterSecs * 1000;\n        this.useFingerprints = useFingerprints;\n        this.fingerprintOptions = fingerprintOptions;\n\n        this.#browserRetireInterval = setInterval(\n            async () =>\n                this.activeBrowserControllers.forEach((controller) => {\n                    if (","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/apify/crawlee/blob/dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c/packages/browser-pool/src/browser-pool.ts#L379-L415","documentation":"BrowserPool can manage multiple browser plugins, but all plugins passed to the constructor must derive from the same plugin class so the pool can rely on a consistent internal interface (BrowserPlugins type). The constructor throws this plain Error when a plugin at index i fails the `instanceof` check against the constructor of the first plugin.","triggerScenarios":"new BrowserPool({ browserPlugins: [new PlaywrightPlugin(), new PuppeteerPlugin()] }) — mixing plugins of different families; passing a similarly-named plugin from a different package/version so instanceof fails.","commonSituations":"Migrating between crawlee/playwright/puppeteer plugin packages; duplicated plugin versions in node_modules (instanceof fails across duplicate copies); accidentally mixing Playwright and Puppeteer plugins in one pool.","solutions":["Pass only plugins of the same class/family to browserPlugins.","Use multiple BrowserPools if you need both Playwright and Puppeteer.","Deduplicate node_modules so a single plugin package version is installed (check `npm ls`)."],"exampleFix":"// before\nnew BrowserPool({ browserPlugins: [new PlaywrightPlugin(), new PuppeteerPlugin()] });\n// after\nnew BrowserPool({ browserPlugins: [new PlaywrightPlugin(), new PlaywrightPlugin()] });\n// or one pool per family:\nconst pwPool = new BrowserPool({ browserPlugins: [new PlaywrightPlugin()] });\nconst ppPool = new BrowserPool({ browserPlugins: [new PuppeteerPlugin()] });","handlingStrategy":"validation","validationCode":"const plugins = [new PlaywrightPlugin(), new PlaywrightPlugin()];\nif (new Set(plugins.map(p => p.constructor)).size !== 1) throw new Error('all plugins must be the same class');\nconst pool = new BrowserPool({ browserPlugins: plugins });","typeGuard":"function samePluginFamily(plugins) { return plugins.every(p => p instanceof plugins[0].constructor); }","tryCatchPattern":null,"preventionTips":["Never mix Playwright and Puppeteer plugins in one pool","Use separate pools per plugin family","Check for duplicate package versions in node_modules breaking instanceof"],"tags":["configuration","plugins","constructor"],"backgroundTag":"incompatible-browser-plugins","analyzedSha":"dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c","analyzedAt":"2026-08-30T22:22:28.328Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}