can1357/oh-my-pi · error · ToolError

xd:// is not mounted in this session.

Error message

xd:// is not mounted in this session.

What it means

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.

Source

Thrown at packages/coding-agent/src/tools/write.ts:1180

										details: { xdev },
										isError: result.isError,
										useless: result.useless,
									};
									return;
								}
								if (name && isResolutionDeviceName(name)) {
									const { result, xdev } = await dispatchResolutionDevice(this.session, name, deviceContent);
									xdResult = {
										content: result.content,
										details: { xdev },
										isError: result.isError,
										useless: result.useless,
									};
									return;
								}
								const xdev = this.session.xdev;
								if (!xdev) {
									throw new ToolError("xd:// is not mounted in this session.");
								}
								if (!name) {
									throw new ToolError(`Cannot write to xd:// itself — pick a device:\n${xdevListing(xdev)}`);
								}
								const { result, xdev: dispatch } = await dispatchXdevTool(
									xdev,
									name,
									deviceContent,
									_toolCallId,
									signal,
									onUpdate as AgentToolUpdateCallback,
									// The write tool's own gate just resolved approval at this
									// device's tier (see #approval above) — mark it so a wrapped
									// inner tool does not prompt a second time.
									context ? { ...context, xdevApproved: true } : undefined,
								);
								xdResult = {
									content: result.content,

View on GitHub (pinned to 9690622007)

Solutions

  1. Mount the xd:// device transport in the session before issuing xd:// writes.
  2. Verify device setup with `read xd://` — if that also fails, the transport is not configured.
  3. Fall back to non-xd paths if the session permits local filesystem access.
  4. Recreate the session with device configuration if the mount was lost.
Defensive patterns

Strategy: fallback

Validate before calling

const mounted = (await read("xd://")).length > 0; // or check session.xdev directly
if (!mounted) throw new Error("xd:// transport not mounted; use local paths or mount devices");

Try / catch

try {
  await write(`xd://${device}`, jsonContent);
} catch (err) {
  if (String(err.message).includes("not mounted")) {
    // fall back to local write or surface a mount-required error
  }
  throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: Model assuming xd:// is always available; device mount failed at session startup; session restarted without re-mounting devices; SDK embedding that skipped transport setup.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/a4dfe8fcf93bd358. Report an issue: GitHub.