{"record":{"id":"456f0df3316c5292","repo":"deepseek-ai/deepseek-harness","slug":"fs-too-large-456f0d","errorCode":"FS_TOO_LARGE","errorMessage":"cannot read \"${target.displayPath}\": ${info.size} bytes exceeds the ${maxBytes}-byte limit","messagePattern":"cannot read \"(.+?)\": (.+?) bytes exceeds the (.+?)-byte limit","errorType":"exception","errorClass":"FsError","httpStatus":null,"severity":"error","filePath":"packages/fs/fs-local/src/fsio.ts","lineNumber":404,"sourceCode":" * Read a whole regular file as raw bytes with no decoding or binary rejection.\n * `maxBytes` bounds the complete content: the stat size short-circuits an\n * oversized file before any content I/O, and the stream reads at most one byte\n * beyond the cap so a file growing after stat cannot cause unbounded buffering.\n * @param target - the resolved file to read.\n * @param signal - aborts the read (`FS_ABORTED`).\n * @param maxBytes - inclusive byte cap on the complete content (`FS_TOO_LARGE`).\n * @param internals - test seam for a deterministic post-stat growth race.\n * @returns the full raw content, at most `maxBytes` long.\n */\nexport async function readWholeBytes(\n  target: LocalTarget,\n  signal: AbortSignal | undefined,\n  maxBytes: number,\n  internals: FsIoInternals = {},\n): Promise<Uint8Array> {\n  const info = await statRegularFile(target, 'read', signal)\n  if (info.size > maxBytes) {\n    throw new FsError(`cannot read \"${target.displayPath}\": ${info.size} bytes exceeds the ${maxBytes}-byte limit`, 'FS_TOO_LARGE')\n  }\n  await internals.inspectReadBytesAfterStat?.(target)\n  const stream = createReadStream(target.targetKey, {\n    end: maxBytes,\n    ...signal ? { signal } : {},\n  })\n  const chunks: Buffer[] = []\n  let bytes = 0\n  try {\n    for await (const chunk of stream as AsyncIterable<Buffer>) {\n      bytes += chunk.length\n      if (bytes > maxBytes) {\n        throw new FsError(`cannot read \"${target.displayPath}\": content exceeds the ${maxBytes}-byte limit`, 'FS_TOO_LARGE')\n      }\n      chunks.push(chunk)\n    }\n  } catch (error: unknown) {\n    /* v8 ignore next 2 -- a mid-stream abort needs cancellation racing an active read; pre-abort is deterministic. */","sourceCodeStart":386,"sourceCodeEnd":422,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/fs/fs-local/src/fsio.ts#L386-L422","documentation":"Error \"cannot read \"${target.displayPath}\": ${info.size} bytes exceeds the ${maxBytes}-byte limit\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/fs/fs-local/src/fsio.ts:404 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"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"}