{"record":{"id":"a4dfe8fcf93bd358","repo":"can1357/oh-my-pi","slug":"xd-is-not-mounted-in-this-session-a4dfe8","errorCode":null,"errorMessage":"xd:// is not mounted in this session.","messagePattern":"xd:// is not mounted in this session\\.","errorType":"validation","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/write.ts","lineNumber":1180,"sourceCode":"\t\t\t\t\t\t\t\t\t\tdetails: { xdev },\n\t\t\t\t\t\t\t\t\t\tisError: result.isError,\n\t\t\t\t\t\t\t\t\t\tuseless: result.useless,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (name && isResolutionDeviceName(name)) {\n\t\t\t\t\t\t\t\t\tconst { result, xdev } = await dispatchResolutionDevice(this.session, name, deviceContent);\n\t\t\t\t\t\t\t\t\txdResult = {\n\t\t\t\t\t\t\t\t\t\tcontent: result.content,\n\t\t\t\t\t\t\t\t\t\tdetails: { xdev },\n\t\t\t\t\t\t\t\t\t\tisError: result.isError,\n\t\t\t\t\t\t\t\t\t\tuseless: result.useless,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tconst xdev = this.session.xdev;\n\t\t\t\t\t\t\t\tif (!xdev) {\n\t\t\t\t\t\t\t\t\tthrow new ToolError(\"xd:// is not mounted in this session.\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (!name) {\n\t\t\t\t\t\t\t\t\tthrow new ToolError(`Cannot write to xd:// itself — pick a device:\\n${xdevListing(xdev)}`);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tconst { result, xdev: dispatch } = await dispatchXdevTool(\n\t\t\t\t\t\t\t\t\txdev,\n\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\tdeviceContent,\n\t\t\t\t\t\t\t\t\t_toolCallId,\n\t\t\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t\t\t\tonUpdate as AgentToolUpdateCallback,\n\t\t\t\t\t\t\t\t\t// The write tool's own gate just resolved approval at this\n\t\t\t\t\t\t\t\t\t// device's tier (see #approval above) — mark it so a wrapped\n\t\t\t\t\t\t\t\t\t// inner tool does not prompt a second time.\n\t\t\t\t\t\t\t\t\tcontext ? { ...context, xdevApproved: true } : undefined,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\txdResult = {\n\t\t\t\t\t\t\t\t\tcontent: result.content,","sourceCodeStart":1162,"sourceCodeEnd":1198,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/write.ts#L1162-L1198","documentation":"Writes to xd:// targets are dispatched through the session's mounted xdev transport (this.session.xdev). If no xdev transport is mounted for the session, any xd:// write fails with this ToolError because there is no device layer to dispatch to.","triggerScenarios":"Calling write with path `xd://<tool>` (or `xd://` itself) in a session where this.session.xdev is undefined — the device transport was never mounted or has been torn down.","commonSituations":"Model assuming xd:// is always available; device mount failed at session startup; session restarted without re-mounting devices; SDK embedding that skipped transport setup.","solutions":["Mount the xd:// device transport in the session before issuing xd:// writes.","Verify device setup with `read xd://` — if that also fails, the transport is not configured.","Fall back to non-xd paths if the session permits local filesystem access.","Recreate the session with device configuration if the mount was lost."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"const mounted = (await read(\"xd://\")).length > 0; // or check session.xdev directly\nif (!mounted) throw new Error(\"xd:// transport not mounted; use local paths or mount devices\");","typeGuard":null,"tryCatchPattern":"try {\n  await write(`xd://${device}`, jsonContent);\n} catch (err) {\n  if (String(err.message).includes(\"not mounted\")) {\n    // fall back to local write or surface a mount-required error\n  }\n  throw err;\n}","preventionTips":["Confirm the device transport is mounted at session startup before any xd:// calls.","Probe with `read xd://` before the first xd:// write of a session.","Re-mount devices after session restarts or transport teardown."],"tags":["device-transport","not-mounted","configuration"],"backgroundTag":"transport-not-mounted","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}