{"record":{"id":"e8c26de6d2d4c2e9","repo":"apify/crawlee","slug":"invalid-proxyurl-unsupported-protocol-proxyu","errorCode":null,"errorMessage":"Invalid \"proxyUrl\". Unsupported protocol: ${proxyUrl}.","messagePattern":"Invalid \"proxyUrl\"\\. Unsupported protocol: (.+?)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/browser-crawler/src/internals/browser-launcher.ts","lineNumber":332,"sourceCode":"                chromeExecutablePath = path86;\n            }\n            return chromeExecutablePath;\n        };\n        switch (os.platform()) {\n            case 'darwin':\n                return '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';\n            case 'win32':\n                return getWin32Path();\n            default:\n                return '/usr/bin/google-chrome';\n        }\n    }\n\n    private validateProxyUrlProtocol(proxyUrl?: string): void {\n        if (!proxyUrl) return;\n\n        if (!/^(http|https|socks4|socks5)/i.test(proxyUrl)) {\n            throw new Error(`Invalid \"proxyUrl\". Unsupported protocol: ${proxyUrl}.`);\n        }\n\n        const url = new URL(proxyUrl);\n\n        if (url.username || url.password) {\n            if (url.protocol !== 'http:' && url.protocol !== 'https:') {\n                throw new Error('Invalid \"proxyUrl\" option: authentication is only supported for HTTP proxy type.');\n            }\n        }\n    }\n}\n","sourceCodeStart":314,"sourceCodeEnd":344,"githubUrl":"https://github.com/apify/crawlee/blob/dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c/packages/browser-crawler/src/internals/browser-launcher.ts#L314-L344","documentation":"`BrowserLauncher.validateProxyUrlProtocol()` validates the `proxyUrl` option before launching the browser. The URL must start with a supported scheme — http, https, socks4, or socks5 (case-insensitive). Anything else (ftp://, missing scheme, typos like `localhost:8080` with no scheme) is rejected with this error at construction time, failing fast instead of producing a broken browser launch.","triggerScenarios":"Passing `proxyUrl: 'ftp://...'`, `'myproxy.com:8080'` (no scheme), `'socks://...'` (generic socks, not socks4/socks5), or an empty-string-prefixed garbage value into `BrowserLauncher`/crawler options; also triggered via `new URL()` paths if the regex passes but the value is malformed.","commonSituations":"Copying a proxy host from a provider dashboard that omits the scheme; using `socks://` because the provider labels it just \"SOCKS\"; accidentally pasting a full provider URL that begins with a scheme the launcher doesn't accept; environment variables containing scheme-less proxy addresses.","solutions":["Prefix the proxy URL with a supported scheme: `http://host:port` (most common) or `socks5://host:port`","Use `socks4://` or `socks5://` explicitly instead of bare `socks://`","If credentials are needed, keep the http/https scheme: `http://user:pass@host:port`","Validate the env/config value before constructing the crawler"],"exampleFix":"// before\nnew PlaywrightCrawler({ launchContext: { proxyUrl: 'my-proxy.example.com:8080' } });\n// after\nnew PlaywrightCrawler({ launchContext: { proxyUrl: 'http://my-proxy.example.com:8080' } });","handlingStrategy":"validation","validationCode":"function assertValidProxyUrl(proxyUrl?: string): void {\n    if (!proxyUrl) return;\n    if (!/^(http|https|socks4|socks5)/i.test(proxyUrl)) {\n        throw new Error(`proxyUrl must start with http(s)/socks4/socks5, got: ${proxyUrl}`);\n    }\n    new URL(proxyUrl); // throws on malformed URLs\n}","typeGuard":null,"tryCatchPattern":"try {\n    const crawler = new PlaywrightCrawler({ launchContext: { proxyUrl } });\n} catch (e) {\n    if (e instanceof Error && /Unsupported protocol/.test(e.message)) {\n        log.error(`Fix proxyUrl scheme: ${e.message}`);\n        process.exit(1);\n    }\n    throw e;\n}","preventionTips":["Always include an explicit scheme (http:// or socks5://) in proxy URLs","Watch for providers giving scheme-less host:port strings — prefix them yourself","Never use bare socks:// — write socks4:// or socks5://"],"tags":["proxy","validation","configuration","browser-launcher"],"backgroundTag":"invalid-proxy-url","analyzedSha":"dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c","analyzedAt":"2026-08-30T22:22:28.328Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}