{"record":{"id":"1dc7f079447546fd","repo":"nodejs/node","slug":"und-err-socks5-auth-method","errorCode":"UND_ERR_SOCKS5_AUTH_METHOD","errorMessage":"Unsupported authentication method: ${method}","messagePattern":"Unsupported authentication method: (.+?)","errorType":"exception","errorClass":"Socks5ProxyError","httpStatus":null,"severity":"error","filePath":"deps/undici/src/lib/core/socks5-client.js","lineNumber":207,"sourceCode":"\n    if (version !== SOCKS_VERSION) {\n      throw new Socks5ProxyError(`Invalid SOCKS version: ${version}`, 'UND_ERR_SOCKS5_VERSION')\n    }\n\n    if (method === AUTH_METHODS.NO_ACCEPTABLE) {\n      throw new Socks5ProxyError('No acceptable authentication method', 'UND_ERR_SOCKS5_AUTH_REJECTED')\n    }\n\n    this.buffer = this.buffer.subarray(2)\n    debug('server selected auth method', method)\n\n    if (method === AUTH_METHODS.NO_AUTH) {\n      this.markAuthenticated()\n    } else if (method === AUTH_METHODS.USERNAME_PASSWORD) {\n      this.state = STATES.AUTHENTICATING\n      this.sendAuthRequest()\n    } else {\n      throw new Socks5ProxyError(`Unsupported authentication method: ${method}`, 'UND_ERR_SOCKS5_AUTH_METHOD')\n    }\n  }\n\n  /**\n   * Send username/password authentication request\n   */\n  sendAuthRequest () {\n    const { username, password } = this.options\n\n    if (!username || !password) {\n      throw new InvalidArgumentError('Username and password required for authentication')\n    }\n\n    debug('sending username/password auth')\n\n    // Username/Password authentication request (RFC 1929)\n    // +----+------+----------+------+----------+\n    // |VER | ULEN |  UNAME   | PLEN |  PASSWD  |","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/undici/src/lib/core/socks5-client.js#L189-L225","documentation":"Thrown in handleHandshakeResponse when the server selected an auth method the client recognizes as neither NO_AUTH (0x00) nor USERNAME_PASSWORD (0x02). The client only implements those two methods (RFC 1928 + RFC 1929); any other selection is unsupported.","triggerScenarios":"Server selects GSSAPI (0x01) or a challenge-response method; a malformed reply where the method byte is garbage but the version byte happened to be 0x05; server selecting a private-use method (0x80-0xFE).","commonSituations":"Proxy configured for GSSAPI/SSPI only; buggy proxy returning an unexpected method byte; protocol desynchronization causing the wrong byte to be read as the method.","solutions":["Configure the proxy to offer NO_AUTH or USERNAME_PASSWORD to this client.","If the method byte is unexpected, treat it as protocol corruption and reconnect on a fresh socket.","Confirm buffer framing is correct (no leftover bytes from a prior exchange).","Log the raw method byte to distinguish a real unsupported method from desync."],"exampleFix":"// before: proxy only allows GSSAPI -> client cannot proceed\n\n// after: reconfigure proxy to permit username/password auth\n// or pick a different proxy endpoint that supports RFC 1929","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { client.handshake() } catch (e) {\n  if (e.code === 'UND_ERR_SOCKS5_AUTH_METHOD') {\n    // server picked an unimplemented method; reconfigure proxy or switch endpoint\n  } else throw e\n}","preventionTips":["Prefer proxies that support NO_AUTH or RFC 1929 USERNAME_PASSWORD.","Log the selected method byte to diagnose server policy.","Reconnect on a fresh socket if you suspect framing desync."],"tags":["socks5","proxy","authentication","protocol","compatibility"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}