websockets/ws · error · Error
None of the extension offers can be accepted
Error message
None of the extension offers can be accepted
What it means
Thrown by `PerMessageDeflate.acceptAsServer()` when none of the client's extension offers satisfy the server's configured constraints. The server walks each offer and rejects it if (a) the server disabled `server_no_context_takeover` but the offer requests it, (b) the offer's `server_max_window_bits` is smaller than what the server requires, or (c) the server pinned `client_max_window_bits` to a number and the offer can't meet it. If every offer is rejected, negotiation fails with this Error.
Solutions
- Loosen the server's `perMessageDeflate` options (drop `clientMaxWindowBits` lower bound, allow `serverNoContextTakeover`).
- If compression is not required, disable it entirely with `perMessageDeflate: false` on the server.
- Catch the error during the handshake (`verifyClient`/`'connection'` setup) and fall back to a no-compression connection or reject the client.
Example fix
// before
const pmd = new PerMessageDeflate({
isServer: true,
clientMaxWindowBits: 15,
serverNoContextTakeover: false
});
pmd.accept([{ server_no_context_takeover: true }]); // throws
// after — align constraints with the offers you expect
const pmd = new PerMessageDeflate({ isServer: true });
pmd.accept([{ client_max_window_bits: true }]); Defensive patterns
Strategy: try-catch
Try / catch
const perMessageDeflate = new PerMessageDeflate({ isServer: true });
try {
perMessageDeflate.accept(parsedOffers);
} catch (err) {
// No offer is compatible with the server's compression policy.
// Fall back to a connection without compression, or reject the client.
negotiateWithoutCompression(socket);
} Prevention
- Keep the server's `perMessageDeflate` options within what common clients offer (don't pin a high `clientMaxWindowBits` lower bound or forbid context takeover unilaterally).
- Expose compression as optional: catch this error and fall back to a no-compression handshake.
- Document the server's compression policy so clients can be configured to match.
When it happens
Trigger: Server created with `new WebSocketServer({ perMessageDeflate: { serverNoContextTakeover: false, clientMaxWindowBits: 15 } })` connecting to a client whose offer has `server_no_context_takeover` set or a smaller `client_max_window_bits`; or any combination where the configured constraints are stricter than every offer received.
Common situations: An over-strict server `perMessageDeflate` config that no real client can satisfy; a custom client that sends only incompatible offers; version skew where a peer advertises window bits the server forbids.
Related errors
- Unexpected or invalid parameter "client_max_window_bits"
- Invalid value for parameter
- Parameter " " must have only a single value
- Unexpected parameter "client_no_context_takeover"
- Unknown parameter
AI-assisted analysis of websockets/ws@c791e707ea (2026-08-06).
Data as JSON: /api/errors/439c93bee3957e46.
Report an issue: GitHub.
Appendix: source
Thrown at lib/permessage-deflate.js:181
(opts.serverNoContextTakeover === false &&
params.server_no_context_takeover) ||
(params.server_max_window_bits &&
(opts.serverMaxWindowBits === false ||
(typeof opts.serverMaxWindowBits === 'number' &&
opts.serverMaxWindowBits > params.server_max_window_bits))) ||
(typeof opts.clientMaxWindowBits === 'number' &&
(typeof params.client_max_window_bits === 'number'
? opts.clientMaxWindowBits > params.client_max_window_bits
: !params.client_max_window_bits))
) {
return false;
}
return true;
});
if (!accepted) {
throw new Error('None of the extension offers can be accepted');
}
if (opts.serverNoContextTakeover) {
accepted.server_no_context_takeover = true;
}
if (opts.clientNoContextTakeover) {
accepted.client_no_context_takeover = true;
}
if (typeof opts.serverMaxWindowBits === 'number') {
accepted.server_max_window_bits = opts.serverMaxWindowBits;
}
if (typeof opts.clientMaxWindowBits === 'number') {
accepted.client_max_window_bits = opts.clientMaxWindowBits;
} else if (
accepted.client_max_window_bits === true ||
opts.clientMaxWindowBits === false
) {
delete accepted.client_max_window_bits;View on GitHub (pinned to c791e707ea)