{"record":{"id":"0785d9b49ec4ecd4","repo":"can1357/oh-my-pi","slug":"disassemble-requires-memory-reference-unless-the-c","errorCode":null,"errorMessage":"disassemble requires memory_reference unless the current stop location has an instruction pointer reference","messagePattern":"disassemble requires memory_reference unless the current stop location has an instruction pointer reference","errorType":"validation","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/debug.ts","lineNumber":579,"sourceCode":"}\n\nfunction requireCapability(capability: keyof DapCapabilities, description: string): DapSessionSummary {\n\tconst snapshot = getActiveSessionSnapshot();\n\tif (dapSessionManager.getCapabilities()?.[capability] !== true) {\n\t\tthrow new ToolError(`Current adapter does not support ${description}`);\n\t}\n\treturn snapshot;\n}\n\nfunction resolveDisassemblyReference(memoryReference: string | undefined): string {\n\tif (memoryReference) {\n\t\treturn memoryReference;\n\t}\n\tconst snapshot = getActiveSessionSnapshot();\n\tif (snapshot.instructionPointerReference) {\n\t\treturn snapshot.instructionPointerReference;\n\t}\n\tthrow new ToolError(\n\t\t\"disassemble requires memory_reference unless the current stop location has an instruction pointer reference\",\n\t);\n}\n\nfunction summarizeDebugCall(args: DebugRenderArgs): string {\n\tconst action = args.action ? args.action.replaceAll(\"_\", \" \") : \"request\";\n\tif (args.program) {\n\t\treturn `${action} ${truncateToWidth(args.program, TRUNCATE_LENGTHS.TITLE)}`;\n\t}\n\tif (args.file && args.line !== undefined) {\n\t\treturn `${action} ${truncateToWidth(`${args.file}:${args.line}`, TRUNCATE_LENGTHS.TITLE)}`;\n\t}\n\tif (args.function) {\n\t\treturn `${action} ${truncateToWidth(args.function, TRUNCATE_LENGTHS.TITLE)}`;\n\t}\n\tif (args.expression) {\n\t\treturn `${action} ${truncateToWidth(args.expression, TRUNCATE_LENGTHS.TITLE)}`;\n\t}","sourceCodeStart":561,"sourceCodeEnd":597,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/debug.ts#L561-L597","documentation":"The disassemble action needs an address to start from: either an explicit `memory_reference` argument, or — when omitted — an instruction-pointer reference from the current stop location. resolveDisassemblyReference found no memory_reference argument and the active session snapshot has no instructionPointerReference, so it cannot determine where to disassemble.","triggerScenarios":"Calling action=disassemble without `memory_reference` while the debuggee is not stopped at a location exposing an instruction pointer reference (either running, or stopped without such a reference).","commonSituations":"Requesting disassembly while the program is running (no current stop); the adapter doesn't provide an instructionPointerReference at the stop; the caller simply forgot to pass memory_reference; calling disassemble before the first breakpoint hit.","solutions":["Pass an explicit `memory_reference` argument (address or memory reference from evaluate/stack frames).","Ensure the debuggee is paused at a breakpoint/stop whose location includes an instruction pointer reference, then retry without memory_reference.","Pause or hit a breakpoint first (e.g. action=pause or set a breakpoint and continue) before disassembling."],"exampleFix":"// before\ndebugTool({ action: \"disassemble\" })\n// after\ndebugTool({ action: \"disassemble\", memory_reference: \"0x7f8a2c000040\" })","handlingStrategy":"validation","validationCode":"if (!memoryReference) {\n  const snap = await debugTool({ action: \"snapshot\" });\n  if (!snap.instructionPointerReference) {\n    throw new Error(\"paused at a stop with an IP reference or provide memory_reference first\");\n  }\n}","typeGuard":"function canDisassemble(args: { memory_reference?: string }, snap?: { instructionPointerReference?: string }): boolean {\n  return !!args.memory_reference || !!snap?.instructionPointerReference;\n}","tryCatchPattern":"try {\n  return await debugTool({ action: \"disassemble\", memory_reference });\n} catch (e) {\n  if (String(e).includes(\"disassemble requires memory_reference\")) {\n    await debugTool({ action: \"pause\" }); // ensure a stop, then retry\n    return await debugTool({ action: \"disassemble\", memory_reference });\n  }\n  throw e;\n}","preventionTips":["Always pass memory_reference for deterministic disassembly.","Only disassemble while the debuggee is paused at a stop.","Capture memory references from evaluate/stack results instead of guessing addresses."],"tags":["debug","dap","disassembly","missing-argument"],"backgroundTag":"missing-memory-reference","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}