earendil-works/pi · error

Rendered line ${i} exceeds terminal width (${visibleWidth(li

Error message

Rendered line ${i} exceeds terminal width (${visibleWidth(line)} > ${width}).

This is likely caused by a custom TUI component not truncating its output.
Use visibleWidth() to measure and truncateToWidth() to truncate lines.

Debug log written to: ${crashLogPath}

What it means

Error "Rendered line ${i} exceeds terminal width (${visibleWidth(line)} > ${width}). This is likely caused by a custom TUI component not truncating its output. Use visibleWidth() to measure and truncateToWidth() to truncate lines. Debug log written to: ${crashLogPath}" thrown in earendil-works/pi.

Source

Thrown at packages/tui/src/tui-main-screen.ts:473

					"=== All rendered lines ===",
					...newLines.map((l, idx) => `[${idx}] (w=${visibleWidth(l)}) ${l}`),
					"",
				].join("\n");
				fs.mkdirSync(path.dirname(crashLogPath), { recursive: true });
				fs.writeFileSync(crashLogPath, crashData);

				// Clean up terminal state before throwing
				this.stop();

				const errorMsg = [
					`Rendered line ${i} exceeds terminal width (${visibleWidth(line)} > ${width}).`,
					"",
					"This is likely caused by a custom TUI component not truncating its output.",
					"Use visibleWidth() to measure and truncateToWidth() to truncate lines.",
					"",
					`Debug log written to: ${crashLogPath}`,
				].join("\n");
				throw new Error(errorMsg);
			}
			buffer += line;
		}

		// Track where cursor ended up after rendering
		let finalCursorRow = renderEnd;

		// If we had more lines before, clear them and move cursor back
		if (this.previousLines.length > newLines.length) {
			// Move to end of new content first if we stopped before it
			if (renderEnd < newLines.length - 1) {
				const moveDown = newLines.length - 1 - renderEnd;
				buffer += `\x1b[${moveDown}B`;
				finalCursorRow = newLines.length - 1;
			}
			const extraLines = this.previousLines.length - newLines.length;
			for (let i = newLines.length; i < this.previousLines.length; i++) {
				buffer += "\r\n\x1b[2K";

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. A custom TUI component rendered an over-wide line; use visibleWidth() to measure and truncateToWidth() to truncate in that component.

When it happens

Trigger: Thrown at packages/tui/src/tui-main-screen.ts:473 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24). Data as JSON: /api/errors/f544527158a89ed1. Report an issue: GitHub.