can1357/oh-my-pi · error · Error

Summary exceeds ${config.summaryHardLimit} bytes

Error message

Summary exceeds ${config.summaryHardLimit} bytes

What it means

postProcessCommitMessage enforces a hard byte limit on the commit summary (first line) after lowercasing, verb normalization, and punctuation trimming. If the summary still exceeds config.summaryHardLimit bytes, it throws instead of emitting an over-long commit subject (raised in postProcessCommitMessage, called by generateConventionalCommit, generateFastCommit, messageFromAnalysis, validateAndProcess).

Source

Thrown at packages/coding-agent/src/commit/conventional/normalization.ts:217

	return joinFirstRest(`${past}${suffix}`, rest);
}

/** Normalize summary, body, and footers before final validation. */
export function postProcessCommitMessage(
	message: ConventionalCommit,
	config: ConventionalGenerationConfig,
): ConventionalCommit {
	let summary = normalizeCommitUnicode(message.summary);
	summary = summary.replaceAll("\r", " ").replaceAll("\n", " ").split(/\s+/).filter(Boolean).join(" ");
	summary = summary
		.trim()
		.replace(/[.;:]+$/g, "")
		.trim();
	summary = lowercaseFirstToken(summary);
	summary = normalizeSummaryVerb(summary, message.type);
	summary = lowercaseFirstToken(summary.trim()).replace(/\.+$/g, "").trim();
	if (Buffer.byteLength(summary) > config.summaryHardLimit) {
		throw new Error(`Summary exceeds ${config.summaryHardLimit} bytes`);
	}

	const body: string[] = [];
	for (const raw of message.body) {
		let detail = normalizeCommitUnicode(raw).replaceAll("\r", " ").replaceAll("\n", " ");
		detail = detail
			.trim()
			.replace(/^[•\-*+]+/, "")
			.trim()
			.split(/\s+/)
			.filter(Boolean)
			.join(" ");
		detail = detail.replace(/[.;,]+$/g, "").trim();
		if (!detail) continue;
		const first = firstCodePoint(detail);
		if (first && first === first.toLowerCase() && first !== first.toUpperCase()) {
			detail = first.toUpperCase() + detail.slice(first.length);
		}

View on GitHub (pinned to 9690622007)

Solutions

  1. Truncate or rewrite the summary before calling post-processing (e.g. cut at word boundary under the limit)
  2. Regenerate with prompt instruction to keep the subject short
  3. Raise config.summaryHardLimit if your project allows longer subjects
  4. Beware multibyte text: measure with Buffer.byteLength and trim to the byte budget

Example fix

// before
const message = await postProcessCommitMessage(raw, config);
// after: pre-trim the summary
const limit = config.summaryHardLimit;
let summary = raw.summary;
while (Buffer.byteLength(summary) > limit) summary = summary.slice(0, summary.lastIndexOf(" ")).trim();
const message = await postProcessCommitMessage({ ...raw, summary }, config);
Defensive patterns

Strategy: validation

Validate before calling

if (Buffer.byteLength(summary) > config.summaryHardLimit) {
  summary = summary.slice(0, config.summaryHardLimit).trim();
}

Try / catch

try {
  message = postProcessCommitMessage(raw, config);
} catch (err) {
  if (err instanceof Error && err.message.includes("Summary exceeds")) {
    // regenerate with a brevity instruction or truncate the subject
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling any commit-message generation/validation entry point with a message whose normalized summary exceeds summaryHardLimit bytes — typically very long model-generated subjects, CJK/multibyte text (byte-length counts UTF-8 bytes, not characters), or a config with an unusually small hard limit.

Common situations: Models ignoring subject-length instructions, multibyte characters pushing byte counts over the limit while looking short, overly verbose generated summaries after scope prefixing, or tightened summaryHardLimit config.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/7c4aab8f2c5c6a6d. Report an issue: GitHub.