{"record":{"id":"490bbbd487c45e9a","repo":"nodejs/node","slug":"und-err-socks5-auth-rejected","errorCode":"UND_ERR_SOCKS5_AUTH_REJECTED","errorMessage":"No acceptable authentication method","messagePattern":"No acceptable authentication method","errorType":"exception","errorClass":"Socks5ProxyError","httpStatus":null,"severity":"error","filePath":"deps/undici/src/lib/core/socks5-client.js","lineNumber":195,"sourceCode":"  }\n\n  /**\n   * Handle handshake response from server\n   */\n  handleHandshakeResponse () {\n    if (this.buffer.length < 2) {\n      return // Not enough data yet\n    }\n\n    const version = this.buffer[0]\n    const method = this.buffer[1]\n\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   */","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/undici/src/lib/core/socks5-client.js#L177-L213","documentation":"Thrown in handleHandshakeResponse when the server's selected method is AUTH_METHODS.NO_ACCEPTABLE (0xFF). Per RFC 1928, 0xFF means the server found no acceptable method among the ones the client offered. This is a configuration/capability mismatch, not malformed data.","triggerScenarios":"Client offered only NO_AUTH but the server requires USERNAME_PASSWORD; client offered USERNAME_PASSWORD but server only accepts GSSAPI or a method not implemented; server policy mandates authentication that the client did not configure.","commonSituations":"Proxy requires auth but credentials were not supplied; using socks5:// URL where socks5h:// with credentials was needed; proxy hardened to require authentication while the client runs anonymous.","solutions":["Provide username/password in the proxy options or the socks5://user:pass@host URL.","Add AUTH_METHODS.USERNAME_PASSWORD to the client's offered methods.","Confirm the proxy's required authentication methods with the operator.","If the proxy truly supports NO_AUTH, check that you connected to the right listener."],"exampleFix":"// before\nconst opts = { authMethods: [AUTH_METHODS.NO_AUTH] }\n\n// after\nconst opts = {\n  username: process.env.PROXY_USER,\n  password: process.env.PROXY_PASS,\n  authMethods: [AUTH_METHODS.USERNAME_PASSWORD]\n}","handlingStrategy":"validation","validationCode":"const wantsAuth = (opts.authMethods || []).includes(AUTH_METHODS.USERNAME_PASSWORD)\nconst hasCreds = opts.username && opts.password\nif (!wantsAuth && !hasCreds && !opts.allowAnonymous) {\n  throw new Error('configure auth or confirm proxy allows NO_AUTH')\n}","typeGuard":null,"tryCatchPattern":"try { client.handshake() } catch (e) {\n  if (e.code === 'UND_ERR_SOCKS5_AUTH_REJECTED') { /* add credentials and retry on new client */ }\n  else throw e\n}","preventionTips":["Match the offered auth methods to what the proxy requires.","Always carry credentials when unsure of the proxy policy.","Document the proxy's required auth method per environment."],"tags":["socks5","proxy","authentication","config","protocol"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}