can1357/oh-my-pi · error · Error
Sloppy edit completed without a result.
Error message
Sloppy edit completed without a result.
What it means
An internal invariant check in the single-file edit path: after processing all sections the code expects at least one edit result, but singleResult is still undefined. This indicates a logic bug (e.g. the sections list was empty but the code proceeded to the result branch) rather than a user-facing input problem.
Source
Thrown at packages/coding-agent/src/edit/sloppy.ts:4019
await onApplied?.({ path: entry.absolutePath, prev: entry.rawContent, next: finalContent });
const editResult = createEditResult({
displayPath: entry.path,
resultPath: entry.absolutePath,
diff: diffResult.diff,
firstChangedLine: diffResult.firstChangedLine,
diagnostics,
oldText: entry.rawContent,
newText: finalContent,
afterPreview: entry.notes,
});
firstChangedLine ??= diffResult.firstChangedLine;
singleResult ??= editResult;
contentTexts.push(editResult.text);
perFileResults.push(editResult.perFileResult);
}
if (!multiFile) {
if (!singleResult) throw new Error("Sloppy edit completed without a result.");
return toEditToolResult(singleResult);
}
return createAggregateEditToolResult(
joinEditResultText(contentTexts),
createAggregateEditDetails({ firstChangedLine, perFileResults }),
);
}
View on GitHub (pinned to 9690622007)
Solutions
- Report as a bug; this should be unreachable
- Check the tool call actually includes a non-empty sections list
- Retry the edit; if reproducible, capture the exact arguments and file a bug report
Example fix
// before: empty sections reaching single-file result path
edit({ path, sections: [] })
// after: guard caller-side with at least one section
edit({ path, sections: [{ heading, body }] }) Defensive patterns
Strategy: try-catch
Validate before calling
if (!sections.length) throw new Error('at least one section required'); Type guard
null
Try / catch
try { await editSloppy(args) } catch (e) { if (e.message === 'Sloppy edit completed without a result.') { reportBug(e); } else throw e } Prevention
- Always pass a non-empty sections array
- Upgrade to latest fix release; this is an invariant bug
- Capture repro args if you can trigger it
- Report with the exact tool call
When it happens
Trigger: Invoking the sloppy edit path in single-file mode where the per-section loop produced no EditResult — effectively a guarded-against internal state, likely from an empty sections array reaching the result aggregation.
Common situations: A tool bug: empty section list passed validation but skipped the loop; a regression in the edit plumbing where results were not assigned.
Related errors
- Cache benchmark prefix template is missing its raw prefix pl
- oldText must not be empty.
- Found ${occurrences} occurrences${pathSuffix}${moreMsg}:\n\n
- ${message} || Unable to read ${sectionPath}
- Missing hashline snapshot tag for ${sectionPath}; use `${HL_
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/776111ffb80b82d1.
Report an issue: GitHub.