{"record":{"id":"b061eb40cdb7d635","repo":"microsoft/playwright","slug":"socks4-proxy-protocol-does-not-support-authenticat","errorCode":null,"errorMessage":"Socks4 proxy protocol does not support authentication","messagePattern":"Socks4 proxy protocol does not support authentication","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/server/browserContext.ts","lineNumber":826,"sourceCode":"      throw new Error('pfx is specified together with cert, key or passphrase');\n  }\n}\n\nexport function normalizeProxySettings(proxy: types.ProxySettings): types.ProxySettings {\n  let { server, bypass } = proxy;\n  let url;\n  try {\n    // new URL('127.0.0.1:8080') throws\n    // new URL('localhost:8080') fails to parse host or protocol\n    // In both of these cases, we need to try re-parse URL with `http://` prefix.\n    url = new URL(server);\n    if (!url.host || !url.protocol)\n      url = new URL('http://' + server);\n  } catch (e) {\n    url = new URL('http://' + server);\n  }\n  if (url.protocol === 'socks4:' && (proxy.username || proxy.password))\n    throw new Error(`Socks4 proxy protocol does not support authentication`);\n  if (url.protocol === 'socks5:' && (proxy.username || proxy.password))\n    throw new Error(`Browser does not support socks5 proxy authentication`);\n  server = url.protocol + '//' + url.host;\n  if (bypass)\n    bypass = bypass.split(',').map(t => t.trim()).join(',');\n  return { ...proxy, server, bypass };\n}\n\nconst paramsThatAllowContextReuse: (keyof channels.BrowserNewContextForReuseParams)[] = [\n  'colorScheme',\n  'forcedColors',\n  'reducedMotion',\n  'contrast',\n  'screen',\n  'userAgent',\n  'viewport',\n  'testIdAttributeName',\n];","sourceCodeStart":808,"sourceCodeEnd":844,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/server/browserContext.ts#L808-L844","documentation":"Thrown by normalizeProxySettings() after it parses the proxy.server URL. SOCKS4 has no authentication mechanism in the protocol, so when the server URL resolves to protocol 'socks4:' and username or password is set, Playwright rejects the configuration rather than silently ignoring the credentials.","triggerScenarios":"Launch/newContext with proxy: { server: 'socks4://host:1080', username: 'u', password: 'p' }. Also reached via launchOptions.proxy or the socksProxyPort-derived socks5 (that one hits 225).","commonSituations":"Corporate SOCKS proxy that requires auth but was configured as socks4. Mistyping socks5 as socks4. Using a SOCKS proxy URL with embedded credentials.","solutions":["Remove username/password from the proxy config if the SOCKS4 proxy truly needs none.","Switch server to an HTTP/HTTPS proxy that supports Basic auth, e.g. proxy: { server: 'http://host:8080', username, password }.","Run an authenticated upstream tunnel (e.g. ssh -D) locally and point Playwright at the unauthenticated local SOCKS endpoint."],"exampleFix":"// before\nproxy: { server: 'socks4://proxy:1080', username: 'u', password: 'p' }\n// after\nproxy: { server: 'socks4://proxy:1080' } // no auth","handlingStrategy":"validation","validationCode":"function validateProxy(proxy?: { server: string; username?: string; password?: string }) {\n  if (!proxy) return;\n  const proto = new URL(proxy.server).protocol;\n  if (proto === 'socks4:' && (proxy.username || proxy.password))\n    throw new Error('SOCKS4 cannot carry auth; remove credentials or switch proxy type');\n}","typeGuard":"function isAuthFreeSocks4(proxy: { server: string; username?: string; password?: string }): boolean {\n  return new URL(proxy.server).protocol !== 'socks4:' || (!proxy.username && !proxy.password);\n}","tryCatchPattern":null,"preventionTips":["Use HTTP proxies when authentication is required.","Run an unauthenticated local SOCKS relay in front of authenticated upstream SOCKS."],"tags":["proxy","socks","network","validation"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}