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

The internal router's xd reader callback resolves xd:// resources, but only when the session actually has an xdev instance mounted (this.session.xdev). Reading xd:// in a session without the device/docs layer throws this ToolError.

Source

Thrown at packages/coding-agent/src/tools/read.ts:2231

		// Reject line selectors when query extraction is used
		if (hasExtraction && parsedSel.kind !== "none" && parsedSel.kind !== "raw") {
			throw new ToolError("Cannot combine query extraction with line selectors");
		}

		// Resolve the internal URL
		const resource = await internalRouter.resolve(url, {
			cwd: this.session.cwd,
			settings: this.session.settings,
			signal,
			sessionFile: this.session.getSessionFile() ?? undefined,
			localProtocolOptions: this.session.localProtocolOptions,
			skills: this.session.skills,
			xd: {
				read: async name => {
					if (name === REPORT_ISSUE_DEVICE_NAME) return reportIssueDeviceUsage();
					if (name && isResolutionDeviceName(name)) return resolutionDeviceUsage(name);
					const xdev = this.session.xdev;
					if (!xdev) throw new ToolError("xd:// is not mounted in this session.");
					return name === null ? xdevListing(xdev) : xdevDocs(xdev, name);
				},
			},
		});
		const details: ReadToolDetails = { resolvedPath: resource.sourcePath, contentType: resource.contentType };

		// If extraction was used, return directly (no pagination)
		if (hasExtraction) {
			return toolResult(details).text(resource.content).sourceInternal(url).done();
		}

		const raw = isRawSelector(parsedSel);
		if (isMultiRange(parsedSel) && parsedSel.kind === "lines") {
			return buildInMemoryMultiRangeResult(this.session, resource.content, parsedSel.ranges, {
				details,
				sourcePath: resource.sourcePath,
				sourceInternal: url,
				entityLabel: "resource",

View on GitHub (pinned to 9690622007)

Solutions

  1. Mount/enable the xd device in the session configuration before reading xd:// URLs.
  2. Check session setup flags/options that populate this.session.xdev.
  3. Use an alternative documentation source (regular files or web read) if xd is unavailable.

Example fix

// before
read("xd://resolution-guide")  // session without xdev
// after
enableXdDevice(session); await read("xd://resolution-guide")
Defensive patterns

Strategy: fallback

Validate before calling

if (url.startsWith('xd://') && !session.xdev) throw new Error('xd not mounted; use an alternative source');

Type guard

function xdAvailable(session) { return session.xdev != null; }

Try / catch

try { return await read(url) } catch (e) { if (String(e.message).includes('not mounted')) { return fallbackDocs(name); } throw e; }

Prevention

When it happens

Trigger: read('xd://doc-name') or read('xd://') in a session where this.session.xdev is undefined — e.g. sessions started without the xd extension/device attached.

Common situations: Agent tries to consult xd docs because docs mention them, but the feature flag/setup that mounts xdev was not enabled for this session; user removed the device.

Related errors


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