{"record":{"id":"29df77276c02ea1f","repo":"deepseek-ai/deepseek-harness","slug":"web-fetch-too-large","errorCode":"WEB_FETCH_TOO_LARGE","errorMessage":"response exceeds the maximum of ${this.limits.maxResponseBytes} bytes","messagePattern":"response exceeds the maximum of (.+?) bytes","errorType":"exception","errorClass":"WebError","httpStatus":null,"severity":"error","filePath":"packages/web/web-fetch-http/src/provider.ts","lineNumber":161,"sourceCode":"      statusCode: response.status,\n      body,\n      truncated: truncatedByBytes || truncatedByChars,\n    }\n  }\n\n  /**\n   * Read the response stream up to `maxResponseBytes`. A `Content-Length` over\n   * the cap rejects immediately with `WEB_FETCH_TOO_LARGE`; a stream that grows\n   * past the cap is cut short (`truncatedByBytes`) rather than rejected, so a\n   * server that under-reports still yields a bounded usable body.\n   */\n  private async readCapped(response: Response, signal: AbortSignal): Promise<{ bytes: Uint8Array; truncatedByBytes: boolean }> {\n    const declared = response.headers.get('content-length')\n    if (declared !== null) {\n      const length = Number(declared)\n      if (Number.isFinite(length) && length > this.limits.maxResponseBytes) {\n        await response.body?.cancel()\n        throw new WebError(`response exceeds the maximum of ${this.limits.maxResponseBytes} bytes`, 'WEB_FETCH_TOO_LARGE')\n      }\n    }\n\n    /* v8 ignore next -- a 2xx Response from fetch always exposes a body stream; the null guard is defensive. */\n    if (response.body === null) return { bytes: new Uint8Array(0), truncatedByBytes: false }\n\n    const chunks: Uint8Array[] = []\n    let total = 0\n    let truncatedByBytes = false\n    const reader = response.body.getReader()\n    try {\n      for (;;) {\n        const { done, value } = await reader.read()\n        if (done) break\n        const remaining = this.limits.maxResponseBytes - total\n        // Only DROPPED bytes count as truncation: a chunk that exactly fills the\n        // remaining capacity keeps all its bytes and we read on to observe EOF,\n        // so an exactly-at-cap body is not falsely flagged truncated.","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/web/web-fetch-http/src/provider.ts#L143-L179","documentation":"Error \"response exceeds the maximum of ${this.limits.maxResponseBytes} bytes\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/web/web-fetch-http/src/provider.ts:161 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Raise maxResponseBytes in configuration or fetch a smaller resource."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}