{"record":{"id":"d4dc06a5ea032451","repo":"can1357/oh-my-pi","slug":"no-hashline-sections-found-in-input","errorCode":null,"errorMessage":"No hashline sections found in input.","messagePattern":"No hashline sections found in input\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/edit/hashline/execute.ts","lineNumber":208,"sourceCode":"\t\tmove: result.moveDest,\n\t\tsourcePath: result.moveDest ? sourcePath : undefined,\n\t\toldText: result.before,\n\t\tnewText: result.after,\n\t\tbeforePreview: result.blockResolutions?.map(formatBlockResolution),\n\t\twarnings: result.warnings,\n\t});\n\treturn {\n\t\ttoolResult: toEditToolResult(editResult),\n\t\tperFileResult: editResult.perFileResult,\n\t};\n}\n\nexport async function executeHashlineSingle(\n\toptions: ExecuteHashlineSingleOptions,\n): Promise<AgentToolResult<EditToolDetails, typeof hashlineEditParamsSchema>> {\n\tconst patch = Patch.parse(options.input, { cwd: options.session.cwd });\n\tif (patch.sections.length === 0) {\n\t\tthrow new Error(\"No hashline sections found in input.\");\n\t}\n\n\tconst fs = new HashlineFilesystem({\n\t\tsession: options.session,\n\t\twritethrough: options.writethrough,\n\t\tbeginDeferredDiagnosticsForPath: options.beginDeferredDiagnosticsForPath,\n\t\tsignal: options.signal,\n\t\tbatchRequest: options.batchRequest,\n\t});\n\tconst snapshots = getFileSnapshotStore(options.session);\n\tconst enforceSeenLines = options.session.settings.get(\"edit.enforceSeenLines\");\n\tconst patcher = new Patcher({ fs, snapshots, blockResolver: nativeBlockResolver, enforceSeenLines });\n\n\t// Named registers persist across edit calls; the anonymous register is\n\t// batch-local. Each batch starts without anonymous state and publishes\n\t// named registers only after writes land.\n\tconst sessionClipboard = getEditClipboard(options.session);\n\tconst clipboard = startClipboardBatch(sessionClipboard);","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/edit/hashline/execute.ts#L190-L226","documentation":"executeHashlineSingle() parses the raw tool input with Patch.parse and throws when no hashline sections were found. The edit tool requires at least one `@@@ path:tag ...` section; input that is empty, plain diff text without hashline headers, or malformed yields zero sections and the tool aborts before touching any file.","triggerScenarios":"Calling the hashline edit tool with empty input, with a unified-diff that lacks `@@@ file` headers, with headers in a format Patch.parse does not recognize, or with only comments/whitespace.","commonSituations":"A model emitting standard git/unified diffs instead of hashline sections; truncation dropping the header line; wrong tool chosen (bash-applying a patch instead of using the edit tool).","solutions":["Re-author the input with at least one valid `@@@ <path>:<tag>` header followed by hashline ops.","Copy the header format directly from a read/search result rather than reconstructing it.","If a unified diff was intended, use the patch tool instead of the hashline edit tool."],"exampleFix":"// before\n--- a/src/a.ts\n+++ b/src/a.ts\n@@ -1 +1 @@\n-old\n+new\n// after\n@@@ src/a.ts:7c4d\n- old\n+ new","handlingStrategy":"validation","validationCode":"if (!/^@@@ \\S+:[0-9a-f]{4}/m.test(input)) {\n  throw new Error('Edit input contains no hashline sections; add an `@@@ path:tag` header');\n}\nawait executeHashlineSingle({ ...options, input });","typeGuard":"function isHashlinePatch(input: string): boolean {\n  return input.split('\\n').some((l) => /^@@@ \\S+/.test(l.trim()));\n}","tryCatchPattern":"try {\n  return await executeHashlineSingle(options);\n} catch (e) {\n  if (e instanceof Error && e.message === 'No hashline sections found in input.') {\n    return convertUnifiedDiffToHashlineAndRetry(options.input);\n  }\n  throw e;\n}","preventionTips":["Start every edit payload with an `@@@ <path>:<tag>` header copied from read output.","Do not paste unified git diffs into the hashline edit tool — use the patch tool.","Check for truncation dropping the header line when building long payloads."],"tags":["hashline","parse-error","empty-input","edit-tool"],"backgroundTag":"no-edit-sections-found","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}