{"record":{"id":"9f8b1b24c69758f2","repo":"can1357/oh-my-pi","slug":"lines-join-n","errorCode":null,"errorMessage":"lines.join(\"\\n\")","messagePattern":"lines\\.join\\(\"\\\\n\"\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/edit/sloppy.ts","lineNumber":249,"sourceCode":"\t}\n\treturn out.join(\"\\n\");\n}\n\n/** Apply a sloppy payload; errors re-voice into the taught `§` vocabulary. */\nexport function applySloppy(content: string, input: string, context: SloppyApplyContext): string {\n\ttry {\n\t\treturn apply(content, input, context);\n\t} catch (error) {\n\t\tif (error instanceof Error) {\n\t\t\tconst lines = toSloppyVoice(error.message).split(\"\\n\");\n\t\t\tfor (let index = 0; index + 1 < lines.length; index++) {\n\t\t\t\tif (!lines[index].startsWith(\"Copy-ready corrected payload\")) continue;\n\t\t\t\tconst opener = lines[index + 1];\n\t\t\t\tif (opener === SECTION_OPENER || opener === `${SECTION_OPENER}*`) {\n\t\t\t\t\tlines[index + 1] = `${opener}${context.path}`;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow new Error(lines.join(\"\\n\"));\n\t\t}\n\t\tthrow error;\n\t}\n}\nconst MAX_CANDIDATES = 200;\nconst MAX_COMBINATIONS = 20_000;\nconst noOpByPath = new Map<string, { hash: string; count: number }>();\nconst ATOMICITY_NOTICE = \"No operations were applied — ops apply atomically; re-send the full corrected payload.\";\n\ninterface ExplicitRewrite {\n\tkind: \"explicit\";\n\ttext: string;\n}\n\ninterface InlineRewrite {\n\tkind: \"inline\";\n\treplacements: string[];\n}","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/edit/sloppy.ts#L231-L267","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the full multi-line message — it contains the root cause and a copy-ready corrected payload to re-send","Re-send the corrected payload shown in the message, filling in the placeholder text","Fix the root cause in the payload (markers, anchors) identified in the first line of the message"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  applySloppy(content, input, ctx);\n} catch (err) {\n  if (err instanceof Error && err.message.includes('Copy-ready corrected payload')) {\n    const corrected = err.message.slice(err.message.indexOf('Copy-ready'));\n    // re-send corrected payload after filling placeholders\n  } else throw err;\n}","preventionTips":["Validate sloppy payload markers (§, », ⟪⟫, │) before submitting","Read the full multi-line message — it embeds the root cause and a corrected payload","Send complete payloads; atomic application means every op must be valid"],"tags":["edit-payload","error-wrapping","sloppy"],"backgroundTag":"invalid-edit-payload-format","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}