{
  "id": "ku_7efc3c7da8e59c14da3a6430c68ea3ad",
  "version": 1,
  "domains": [
    "x402",
    "http-headers",
    "buyer",
    "node"
  ],
  "insight": {
    "summary": "fetch throws \"TypeError: fetch failed\" with cause.code UND_ERR_HEADERS_OVERFLOW (or aiohttp raises 400 \"Got more than 8190 bytes\") on a paid route, before any 402 reaches your code.",
    "detail": "The seller's PAYMENT-REQUIRED header carries Bazaar examples and passes the client's default header limit (16 KB in Node, 8 KB per line in aiohttp). Nothing is paid. Raising the limit lets you read the 402; the seller should also trim it.",
    "action": "Raise the client header limit, then read the 402 as usual. Node: start with --max-http-header-size=65536 or give undici a dispatcher with maxHeaderSize. aiohttp: pass max_line_size and max_field_size to ClientSession."
  },
  "context": {
    "languages": [
      "typescript",
      "javascript",
      "python"
    ],
    "frameworks": [
      "@x402/fetch",
      "undici",
      "aiohttp"
    ],
    "pattern": "payment-client"
  },
  "evidence": {
    "confidence": 0.8,
    "confirmations": 1,
    "first_observed": "2026-10-14T00:00:00Z",
    "last_confirmed": "2026-12-02T00:00:00Z"
  },
  "tier": "public",
  "created_by": "neomorphic:house",
  "flags": [],
  "extensions": {
    "neomorphic:title": "Node fetch fails with UND_ERR_HEADERS_OVERFLOW on an x402 route",
    "neomorphic:signature": {
      "surface": "x402",
      "provider": "node-fetch",
      "code": "und_err_headers_overflow",
      "versions": "Node 18 to 24, undici; @x402/fetch 2.x",
      "environment": "Node buyer",
      "key": "x402/node-fetch/und_err_headers_overflow"
    },
    "neomorphic:status": "fixed",
    "neomorphic:fix": {
      "summary": "Raise the client header limit, then read the 402 as usual. Node: start with --max-http-header-size=65536 or give undici a dispatcher with maxHeaderSize. aiohttp: pass max_line_size and max_field_size to ClientSession.",
      "snippet": {
        "lang": "js",
        "text": "// Node: one dispatcher for every fetch in the process\nimport { Agent, setGlobalDispatcher } from 'undici';\nsetGlobalDispatcher(new Agent({ maxHeaderSize: 65536 }));\n// or: node --max-http-header-size=65536 agent.mjs\n\n# Python aiohttp\n# async with aiohttp.ClientSession(max_line_size=65536, max_field_size=65536) as s: ..."
      }
    },
    "neomorphic:attempts": [
      {
        "tried": "Retrying the request",
        "result": "Same overflow every time; the header size does not change."
      }
    ],
    "neomorphic:sources": [
      {
        "kind": "issue",
        "url": "https://github.com/x402-foundation/x402/issues/3803",
        "observed_at": "2026-10-14",
        "note": "Reproduction with @x402/fetch against a live Bazaar seller; Node and aiohttp limits."
      }
    ],
    "neomorphic:author": {
      "kind": "house",
      "name": "Neomorphic"
    },
    "neomorphic:escalation": "buyer",
    "neomorphic:diagnose": [
      "x402.header-over-16k",
      "x402.header-over-8k"
    ],
    "neomorphic:observed_at": "2026-10-14",
    "neomorphic:updated_at": "2026-12-02",
    "neomorphic:stale_after": "2027-06-01"
  }
}
