{"record":{"id":"9d0db20f45a90999","repo":"can1357/oh-my-pi","slug":"command-is-required-for-custom-request","errorCode":null,"errorMessage":"command is required for custom_request","messagePattern":"command is required for custom_request","errorType":"validation","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/debug.ts","lineNumber":1086,"sourceCode":"\t\t\t\t\tparams.start_module,\n\t\t\t\t\tparams.module_count,\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.modules = response.modules;\n\t\t\t\treturn result.text(formatModules(response.modules)).done();\n\t\t\t}\n\t\t\tcase \"loaded_sources\": {\n\t\t\t\trequireCapability(\"supportsLoadedSourcesRequest\", \"loaded sources\");\n\t\t\t\tconst response = await dapSessionManager.loadedSources(combinedSignal, timeoutSec * 1000);\n\t\t\t\tdetails.snapshot = response.snapshot;\n\t\t\t\tdetails.sources = response.sources;\n\t\t\t\treturn result.text(formatLoadedSources(response.sources)).done();\n\t\t\t}\n\t\t\tcase \"custom_request\": {\n\t\t\t\tif (!params.command) {\n\t\t\t\t\tthrow new ToolError(\"command is required for custom_request\");\n\t\t\t\t}\n\t\t\t\tconst response = await dapSessionManager.customRequest(\n\t\t\t\t\tparams.command,\n\t\t\t\t\tparams.arguments,\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.customBody = response.body;\n\t\t\t\treturn result.text(formatCustomResponse(params.command, response.body)).done();\n\t\t\t}\n\t\t\tcase \"output\": {\n\t\t\t\tconst response = dapSessionManager.getOutput();\n\t\t\t\tdetails.snapshot = response.snapshot;\n\t\t\t\tdetails.output = response.output;\n\t\t\t\treturn result.text(response.output.length > 0 ? response.output : \"(no output captured)\").done();\n\t\t\t}\n\t\t\tcase \"terminate\": {","sourceCodeStart":1068,"sourceCodeEnd":1104,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/debug.ts#L1068-L1104","documentation":"The debug tool's custom_request action forwards an arbitrary DAP command (and optional arguments) to the debug adapter via customRequest. Because the command name is mandatory — the adapter has nothing to dispatch without it — the tool throws this ToolError when params.command is missing or empty. Unlike the typed actions, this branch has no capability precheck, so parameter validation is the only guard.","triggerScenarios":"Calling action=\"custom_request\" with params.command undefined, null, or empty string; also when the DAP command name is placed under a wrong key (method, request, name) or supplied only inside params.arguments.","commonSituations":"Trying vendor-specific DAP extensions (e.g. custom breakpoint or evaluate variants) where the caller put the command into arguments instead of command; scripted calls built dynamically that skipped the command field; confusion between the tool action name and the DAP command string.","solutions":["Set params.command to the DAP request name string, e.g. command: \"myVendorCustomRequest\".","Put any payload in params.arguments, not in command — command must be a plain string.","Check the parameter key spelling (command, not method/request/name).","If a built-in action exists for your intent (set_breakpoints, evaluate, read_memory, …), use it instead of custom_request."],"exampleFix":"// before\nawait debugTool.run({ action: \"custom_request\", arguments: { threads: true } });\n// after\nawait debugTool.run({ action: \"custom_request\", command: \"myCustomThreads\", arguments: {} });","handlingStrategy":"validation","validationCode":"if (typeof command !== \"string\" || command.length === 0) throw new Error(\"custom_request requires a DAP command name string\");","typeGuard":"function hasCommand(p: { command?: string }): p is { command: string } {\n  return typeof p.command === \"string\" && p.command.length > 0;\n}","tryCatchPattern":"try {\n  await debugTool.run({ action: \"custom_request\", command: dapCommand, arguments: args });\n} catch (err) {\n  if (err instanceof ToolError && err.message.includes(\"command is required\")) {\n    // move the request name out of arguments into the command field and retry\n  } else throw err;\n}","preventionTips":["Remember custom_request has two fields: command (string, required) and arguments (object, optional).","Prefer built-in tool actions over custom_request whenever one exists.","Consult the adapter's vendor documentation for the exact DAP command name before calling."],"tags":["debugger","dap","parameter-validation","missing-parameter"],"backgroundTag":"missing-required-parameter","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}