{"record":{"id":"3e64b018821704ef","repo":"oven-sh/bun","slug":"wrong-length","errorCode":null,"errorMessage":"Wrong length","messagePattern":"Wrong length","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"bench/snippets/buffer-concat.mjs","lineNumber":29,"sourceCode":"  const check = true;\n\n  const buffers = [first, second, third];\n\n  const fmt =\n    size > 1024 * 1024\n      ? new Intl.NumberFormat(undefined, { unit: \"megabyte\", style: \"unit\" })\n      : size > 1024\n        ? new Intl.NumberFormat(undefined, { unit: \"kilobyte\", style: \"unit\" })\n        : new Intl.NumberFormat(undefined, { unit: \"byte\", style: \"unit\" });\n\n  bench(\n    `Buffer.concat(${fmt.format(\n      Number((size > 1024 * 1024 ? size / 1024 / 1024 : size > 1024 ? size / 1024 : size).toFixed(2)),\n    )} x 3)`,\n    () => {\n      const result = Buffer.concat(buffers);\n      if (check) {\n        if (result.byteLength != size * 3) throw new Error(\"Wrong length\");\n        if (result[0] != 1) throw new Error(\"Wrong first byte\");\n        if (result[size] != 2) throw new Error(\"Wrong second byte\");\n        if (result[size * 2] != 3) throw new Error(\"Wrong third byte\");\n\n        result[0] = 10;\n        if (first[0] != 1) throw new Error(\"First buffer was modified\");\n\n        result[size] = 20;\n        if (second[0] != 2) throw new Error(\"Second buffer was modified\");\n\n        result[size * 2] = 30;\n        if (third[0] != 3) throw new Error(\"Third buffer was modified\");\n      }\n    },\n  );\n}\n\nconst chunk = Buffer.alloc(16);","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/bench/snippets/buffer-concat.mjs#L11-L47","documentation":"A generic 'input or state is invalid' sentinel declared in the install error enum (src/install/error.rs:183-184). It currently has no production construction sites in this tree, so an occurrence implies an older/alternative code path rejected something as invalid without a more specific variant.","triggerScenarios":"None reachable from current Bun code paths; reserved for generic invalid-input outcomes.","commonSituations":"Seeing it in practice almost certainly means an outdated Bun build or an internal bug path.","solutions":["Upgrade Bun to the latest version","If it reproduces on current Bun, capture the exact command + lockfile and file an issue at https://github.com/oven-sh/bun/issues"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await Bun.$`bun install`;\n} catch (err) {\n  console.error(\"install failed:\", err.stderr?.toString() ?? err);\n  process.exit(1);\n}","preventionTips":["Keep Bun current; this variant has no active throw sites in modern builds","Capture the full command + lockfile if it appears so it can be reported upstream"],"tags":["install","internal"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}