{"record":{"id":"13c71c53e7bd2cb3","repo":"can1357/oh-my-pi","slug":"set-breakpoint-requires-file-line-or-function","errorCode":null,"errorMessage":"set_breakpoint requires file+line or function","messagePattern":"set_breakpoint requires file\\+line or function","errorType":"validation","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/debug.ts","lineNumber":803,"sourceCode":"\t\t\t\t);\n\t\t\t\tdetails.snapshot = snapshot;\n\t\t\t\tdetails.adapter = adapter.name;\n\t\t\t\treturn result.text(formatSessionSnapshot(snapshot).join(\"\\n\")).done();\n\t\t\t}\n\t\t\tcase \"set_breakpoint\": {\n\t\t\t\tif (params.function) {\n\t\t\t\t\tconst response = await dapSessionManager.setFunctionBreakpoint(\n\t\t\t\t\t\tparams.function,\n\t\t\t\t\t\tparams.condition,\n\t\t\t\t\t\tcombinedSignal,\n\t\t\t\t\t\ttimeoutSec * 1000,\n\t\t\t\t\t);\n\t\t\t\t\tdetails.snapshot = response.snapshot;\n\t\t\t\t\tdetails.functionBreakpoints = response.breakpoints;\n\t\t\t\t\treturn result.text(formatFunctionBreakpoints(response.breakpoints)).done();\n\t\t\t\t}\n\t\t\t\tif (!params.file || params.line === undefined) {\n\t\t\t\t\tthrow new ToolError(\"set_breakpoint requires file+line or function\");\n\t\t\t\t}\n\t\t\t\tconst file = resolveToCwd(params.file, this.session.cwd);\n\t\t\t\tconst response = await dapSessionManager.setBreakpoint(\n\t\t\t\t\tfile,\n\t\t\t\t\tparams.line,\n\t\t\t\t\tparams.condition,\n\t\t\t\t\tcombinedSignal,\n\t\t\t\t\ttimeoutSec * 1000,\n\t\t\t\t);\n\t\t\t\tdetails.snapshot = response.snapshot;\n\t\t\t\tdetails.breakpoints = response.breakpoints;\n\t\t\t\treturn result.text(formatBreakpoints(response.sourcePath, response.breakpoints)).done();\n\t\t\t}\n\t\t\tcase \"remove_breakpoint\": {\n\t\t\t\tif (params.function) {\n\t\t\t\t\tconst response = await dapSessionManager.removeFunctionBreakpoint(\n\t\t\t\t\t\tparams.function,\n\t\t\t\t\t\tcombinedSignal,","sourceCodeStart":785,"sourceCodeEnd":821,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/debug.ts#L785-L821","documentation":"The debug tool's set_breakpoint action throws this ToolError when neither a file+line pair nor a function name is supplied. Setting a source breakpoint requires a location; the DAP session manager cannot place a breakpoint without one. This is an input-validation guard before any DAP request is issued.","triggerScenarios":"Calling the debug tool with action=set_breakpoint and params where params.file is empty/missing or params.line is undefined, and the function branch (params.function) was not taken.","commonSituations":"Agent omits the line number when setting a breakpoint on a file; caller passes line: 0 or null thinking it means 'whole file'; caller only provides a condition without a location; schema drift between tool caller and tool definition.","solutions":["Pass both file (path) and line (1-based number) in params, e.g. {file: 'src/index.ts', line: 42}","Or pass function instead of file+line to set a function breakpoint","Check the tool schema for set_breakpoint to confirm required fields before calling"],"exampleFix":"// before\nawait debugTool.run({ action: 'set_breakpoint', file: 'src/index.ts' });\n// after\nawait debugTool.run({ action: 'set_breakpoint', file: 'src/index.ts', line: 42 });","handlingStrategy":"validation","validationCode":"function canSetSourceBreakpoint(params) {\n  return (typeof params.file === 'string' && params.file.length > 0 && Number.isInteger(params.line))\n    || (typeof params.function === 'string' && params.function.length > 0);\n}\nif (!canSetSourceBreakpoint(params)) throw new Error('set_breakpoint needs file+line or function');","typeGuard":"function hasSourceLocation(p) {\n  return typeof p === 'object' && p !== null\n    && typeof (p as { file?: unknown }).file === 'string'\n    && typeof (p as { line?: unknown }).line === 'number';\n}","tryCatchPattern":"try {\n  await debugTool.run({ action: 'set_breakpoint', ...params });\n} catch (err) {\n  if (err instanceof ToolError && err.message.includes('requires file+line or function')) {\n    // re-invoke with a complete location or surface a usage hint\n  } else throw err;\n}","preventionTips":["Always pair file with a 1-based line number when setting source breakpoints","Use the function form when you only know the symbol name","Validate params against the tool's input schema before dispatching"],"tags":["debug","dap","parameter-validation","breakpoint"],"backgroundTag":"missing-required-parameter","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}