{"record":{"id":"c3058957d7549a58","repo":"denoland/deno","slug":"err-http2-invalid-setting-value","errorCode":"ERR_HTTP2_INVALID_SETTING_VALUE","errorMessage":"Invalid value for setting \"enablePush\": ${settings.enablePush}","messagePattern":"Invalid value for setting \"enablePush\": (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"ext/node/polyfills/http2.ts","lineNumber":1428,"sourceCode":"    kMaxStreams,\n  );\n  assertWithinRange(\n    \"maxHeaderListSize\",\n    settings.maxHeaderListSize,\n    0,\n    kMaxInt,\n  );\n  assertWithinRange(\n    \"maxHeaderSize\",\n    settings.maxHeaderSize,\n    0,\n    kMaxInt,\n  );\n  if (\n    settings.enablePush !== undefined &&\n    typeof settings.enablePush !== \"boolean\"\n  ) {\n    throw new ERR_HTTP2_INVALID_SETTING_VALUE.HideStackFramesError(\n      \"enablePush\",\n      settings.enablePush,\n    );\n  }\n  if (\n    settings.enableConnectProtocol !== undefined &&\n    typeof settings.enableConnectProtocol !== \"boolean\"\n  ) {\n    throw new ERR_HTTP2_INVALID_SETTING_VALUE.HideStackFramesError(\n      \"enableConnectProtocol\",\n      settings.enableConnectProtocol,\n    );\n  }\n});\n\n// Allow selectively copying the entries that have explicitly been set to\n// another typed array. In upstream Node this wraps the TypedArray in a Proxy\n// to track index assignments. Deno's polyfill does not (yet) replace this","sourceCodeStart":1410,"sourceCodeEnd":1446,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/ext/node/polyfills/http2.ts#L1410-L1446","documentation":"In validateSettings, settings.enablePush must be a boolean when provided; any other type (string 'false', number 1, null-ish handled separately) throws ERR_HTTP2_INVALID_SETTING_VALUE with the offending value embedded in the message. enablePush controls whether the client accepts server push, so a truthy-but-wrong type cannot be silently coerced.","triggerScenarios":"http2.connect(url, { settings: { enablePush: 'false' } }); settings sourced from process.env (always strings); updateSettings({ enablePush: 1 }); JSON config where the value was quoted.","commonSituations":"Feature flags wired through environment variables (DISABLE_PUSH='true') and passed without conversion; YAML/JSON configs that serialize booleans as strings; flags defaulting to numbers (0/1) from CLI parsers.","solutions":["Coerce env-derived values: enablePush: process.env.DISABLE_PUSH !== 'true'","Validate the settings object with a boolean check before connect/updateSettings (see validationCode)","Type the settings parameter (Partial<http2.Settings>) so TypeScript rejects non-booleans at compile time"],"exampleFix":"// before\nhttp2.connect(url, { settings: { enablePush: process.env.PUSH } }); // string → throws\n\n// after\nhttp2.connect(url, {\n  settings: { enablePush: process.env.PUSH === 'true' }, // real boolean\n});","handlingStrategy":"validation","validationCode":"const bool = (v: unknown): boolean | undefined =>\n  v === undefined ? undefined : v === true || v === 'true';\nhttp2.connect(url, { settings: { enablePush: bool(cfg.enablePush) } });","typeGuard":"const isBooleanOrUndefined = (v: unknown): v is boolean | undefined =>\n  v === undefined || typeof v === 'boolean';","tryCatchPattern":null,"preventionTips":["Coerce env-var and CLI-derived values to real booleans at the boundary","Type settings as Partial<http2.Settings> and let the compiler reject strings/numbers","Freeze validated settings objects after config parsing"],"tags":["http2","settings","type-validation","node-compat","env-vars"],"backgroundTag":"http2-invalid-setting","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}