can1357/oh-my-pi · error · Error
${error.message} Copy-ready corrected payload: ${retry}
Error message
${error.message}
Copy-ready corrected payload:
${retry} What it means
When payload parsing fails inside applySloppyEdit, the library catches the parse error and re-throws it with a 'Copy-ready corrected payload:' section appended. The appended payload is the normalized input, prefixed with the opener line if the first line lacked one, so the caller can fix and retry with a syntactically valid payload directly. If the message already carries this section it is re-thrown untouched to avoid double augmentation.
Source
Thrown at packages/coding-agent/src/edit/sloppy.ts:3551
? `\nYour rewrite normalized to text identical to these lines. Indentation-only changes are applied verbatim; adjust the authored REWRITE if another whitespace change was intended.\nCurrent file content near the closest match (no re-read needed):\n${numberedPreview(preview.content, preview.offset)}`
: "";
throw new Error(base + grounding + (hint ? `\n${hint}` : ""));
};
let operations: Operation[];
try {
operations = parseOperations(input, content);
} catch (error) {
if (!(error instanceof Error)) throw error;
// A parse error that already carries a copy-ready payload (e.g. the
// fill-in skeleton) must not be followed by an echo of the broken input.
if (error.message.includes("Copy-ready corrected payload")) throw error;
const normalizedPayload = normalizeInput(input);
const retry =
parseOpener(normalizedPayload.split("\n")[0] ?? "") === false
? `${OPENER}\n${normalizedPayload}`
: normalizedPayload;
throw new Error(`${error.message}\nCopy-ready corrected payload:\n${retry}`);
}
const removedByOperation: Array<string | undefined> = [];
const planned: PlannedEdit[] = [];
const deletionNotes = new Map<number, string>();
const recoveryNotes: string[] = [];
let lastMatchOffset = 0;
// Ambiguous ops defer once: after every sibling plans its edit, their spans
// exclude already-claimed candidates and a genuinely unique match survives.
const queue = operations.map((_, order) => order);
const deferredAmbiguous = new Set<number>();
for (let cursor = 0; cursor < queue.length; cursor++) {
const index = queue[cursor];
const operationNumber = index + 1;
const parsedNote = operations[index].recoveryNote;
if (parsedNote !== undefined) recoveryNotes.push(parsedNote);
let located: { operation: Operation; pattern: ParsedPattern; candidates: Candidate[] };
try {
located = locateWithEchoRecovery(View on GitHub (pinned to 9690622007)
Solutions
- Take the copy-ready payload from the error message, fix the reported syntax problem, and resubmit it.
- Ensure the first line is a valid opener (e.g. » or the variant's opener); the normalization only prepends it when the opener parses as false.
- Re-emit the payload in full with correct markers and separators rather than patching fragments.
Example fix
// before (missing opener) const x = 1 ==== const x = 2 // after (opener added) » const x = 1 ==== const x = 2
Defensive patterns
Strategy: try-catch
Validate before calling
function assertPayloadShape(payload: string, opener: RegExp) {
if (!opener.test(payload.split("\n")[0] ?? ""))
throw new Error("payload must start with a valid opener line");
if (!payload.includes("====")) throw new Error("payload must contain PATTERN/REWRITE separators");
} Try / catch
try {
applySloppyEdit(payload);
} catch (err) {
if (err instanceof Error && err.message.includes("Copy-ready corrected payload:")) {
const corrected = err.message.split("Copy-ready corrected payload:\n")[1];
applySloppyEdit(corrected);
} else throw err;
} Prevention
- Always start payloads with the correct opener line for the active variant
- Take the 'Copy-ready corrected payload' from the error verbatim and edit from there
- Validate separators and marker alphabet before calling apply
When it happens
Trigger: parseOperations throws (malformed opener, bad markers, malformed operations) while calling applySloppyEdit; the catch block at sloppy.ts:3551 augments any error message not already containing 'Copy-ready corrected payload'.
Common situations: Missing or malformed opener on the first line; stray whitespace/normalization differences; model payloads with slightly wrong marker alphabet; hand-written payloads missing the separator lines.
Related errors
- ${error.message} (augmented with "\nCurrent file content nea
- Operation ${operationNumber} has selection markers in REWRIT
- Operation ${operationNumber} REWRITE has a whole-line ${GAP}
- ${REWRITE_HEADER}${reference[1]} must reference an earlier d
- ${base}${grounding}${hint ? `\n${hint}` : ""} (no-op: e.g. "
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/7113305b262d9747.
Report an issue: GitHub.