can1357/oh-my-pi · error

lines.join("\n")

Error message

lines.join("\n")

What it means

applySloppy wraps the sloppy-payload apply engine and re-voices any engine Error into the taught '§' vocabulary (converting opener markers and merging [path] header lines) before rethrowing. The message is 'lines.join("\n")' because the thrown error's message is literally the re-voiced multi-line payload-feedback text — it is a wrapper rethrow, not a distinct failure.

Source

Thrown at packages/coding-agent/src/edit/sloppy.ts:249

	}
	return out.join("\n");
}

/** Apply a sloppy payload; errors re-voice into the taught `§` vocabulary. */
export function applySloppy(content: string, input: string, context: SloppyApplyContext): string {
	try {
		return apply(content, input, context);
	} catch (error) {
		if (error instanceof Error) {
			const lines = toSloppyVoice(error.message).split("\n");
			for (let index = 0; index + 1 < lines.length; index++) {
				if (!lines[index].startsWith("Copy-ready corrected payload")) continue;
				const opener = lines[index + 1];
				if (opener === SECTION_OPENER || opener === `${SECTION_OPENER}*`) {
					lines[index + 1] = `${opener}${context.path}`;
				}
			}
			throw new Error(lines.join("\n"));
		}
		throw error;
	}
}
const MAX_CANDIDATES = 200;
const MAX_COMBINATIONS = 20_000;
const noOpByPath = new Map<string, { hash: string; count: number }>();
const ATOMICITY_NOTICE = "No operations were applied — ops apply atomically; re-send the full corrected payload.";

interface ExplicitRewrite {
	kind: "explicit";
	text: string;
}

interface InlineRewrite {
	kind: "inline";
	replacements: string[];
}

View on GitHub (pinned to 9690622007)

Solutions

  1. Read the full multi-line message — it contains the root cause and a copy-ready corrected payload to re-send
  2. Re-send the corrected payload shown in the message, filling in the placeholder text
  3. Fix the root cause in the payload (markers, anchors) identified in the first line of the message
Defensive patterns

Strategy: try-catch

Try / catch

try {
  applySloppy(content, input, ctx);
} catch (err) {
  if (err instanceof Error && err.message.includes('Copy-ready corrected payload')) {
    const corrected = err.message.slice(err.message.indexOf('Copy-ready'));
    // re-send corrected payload after filling placeholders
  } else throw err;
}

Prevention

When it happens

Trigger: Any invalid sloppy edit payload (bad markers, unmatched anchors, empty REWRITE, etc.) passed to applySloppy/executeSloppy; the original engine error surfaces here with its 'Copy-ready corrected payload' section rewritten to include the real file path after the § opener.

Common situations: An LLM emits a slightly malformed § payload; the corrected-payload guidance lines get merged with the file path; developers debugging see this wrapping frame rather than the root parse error.

Related errors


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