yamadashy/repomix · error · RepomixError

Cannot split output: '${group.rootEntry}' exceeds max size o

Error message

Cannot split output: '${group.rootEntry}' exceeds max size on its own. Size ${nextBytes.toLocaleString()} bytes > limit ${maxBytesPerPart.toLocaleString()} bytes. A single file cannot be split across parts.

What it means

The split algorithm subdivides groups (directories) until each fits within maxBytesPerPart; when it reaches a leaf whose content is a single file larger than the limit — and files cannot be subdivided — it throws. Repomix refuses to split a single file across parts, so the requested per-part size is below the largest file's size.

Source

Thrown at src/core/output/outputSplit.ts:280

    }

    // The group does not fit alongside what is already accumulated: flush the current part
    // and retry this group on a fresh part.
    if (currentGroups.length > 0) {
      finalizeCurrentPart();
      queue.unshift(group);
      continue;
    }

    // The group does not fit even on its own. Split it one directory level deeper and retry
    // the finer-grained groups. Only a single file cannot be divided further.
    const subGroups = subdivideSplitGroup(group);
    if (subGroups) {
      queue.unshift(...subGroups);
      continue;
    }

    throw new RepomixError(
      `Cannot split output: '${group.rootEntry}' exceeds max size on its own. ` +
        `Size ${nextBytes.toLocaleString()} bytes > limit ${maxBytesPerPart.toLocaleString()} bytes. ` +
        'A single file cannot be split across parts.',
    );
  }

  if (currentGroups.length > 0) {
    finalizeCurrentPart();
  }

  return parts;
};

View on GitHub (pinned to f465ad9093)

Solutions

  1. Increase maxBytesPerPart to at least the size of the largest file (find it, e.g. via the size metric in repomix output).
  2. Exclude the oversized file via ignore patterns (or it likely shouldn't be packed: minified/binary/lock files).
  3. Split the large file into smaller files in the repo before packing.

Example fix

// before
await generateSplitOutputParts({ maxBytesPerPart: 100_000, ... }); // huge-file.ts is 250KB
// after
await generateSplitOutputParts({ maxBytesPerPart: 512_000, ... }); // > largest single file
Defensive patterns

Strategy: validation

Validate before calling

const maxFileSize = Math.max(...processedFiles.map(f => f.content.length));
if (maxFileSize > maxBytesPerPart) {
  // exclude or raise limit before splitting
}

Type guard

null

Try / catch

try {
  await generateSplitOutputParts({ maxBytesPerPart, ... });
} catch (e) {
  if (e instanceof RepomixError && e.message.includes('exceeds max size on its own')) {
    console.error('Raise maxBytesPerPart above the largest file, or ignore that file');
  } else throw e;
}

Prevention

When it happens

Trigger: Running split output with maxBytesPerPart smaller than the largest processed file's byte size (group.rootEntry); the subdivision queue drains to that single oversized group and throws instead of emitting an invalid part.

Common situations: Setting a small per-part limit (e.g. 100KB) while the repo contains a big bundled/minified file or large dataset; limit tuned for average size, not max file size.

Related errors


AI-assisted analysis of yamadashy/repomix@f465ad9093 (2026-08-29). Data as JSON: /api/errors/e2b84c24323e5a6e. Report an issue: GitHub.