{"record":{"id":"0fa277f4b21a4c8e","repo":"can1357/oh-my-pi","slug":"xd-is-not-mounted-in-this-session-0fa277","errorCode":null,"errorMessage":"xd:// is not mounted in this session.","messagePattern":"xd:// is not mounted in this session\\.","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/read.ts","lineNumber":2231,"sourceCode":"\t\t// Reject line selectors when query extraction is used\n\t\tif (hasExtraction && parsedSel.kind !== \"none\" && parsedSel.kind !== \"raw\") {\n\t\t\tthrow new ToolError(\"Cannot combine query extraction with line selectors\");\n\t\t}\n\n\t\t// Resolve the internal URL\n\t\tconst resource = await internalRouter.resolve(url, {\n\t\t\tcwd: this.session.cwd,\n\t\t\tsettings: this.session.settings,\n\t\t\tsignal,\n\t\t\tsessionFile: this.session.getSessionFile() ?? undefined,\n\t\t\tlocalProtocolOptions: this.session.localProtocolOptions,\n\t\t\tskills: this.session.skills,\n\t\t\txd: {\n\t\t\t\tread: async name => {\n\t\t\t\t\tif (name === REPORT_ISSUE_DEVICE_NAME) return reportIssueDeviceUsage();\n\t\t\t\t\tif (name && isResolutionDeviceName(name)) return resolutionDeviceUsage(name);\n\t\t\t\t\tconst xdev = this.session.xdev;\n\t\t\t\t\tif (!xdev) throw new ToolError(\"xd:// is not mounted in this session.\");\n\t\t\t\t\treturn name === null ? xdevListing(xdev) : xdevDocs(xdev, name);\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\t\tconst details: ReadToolDetails = { resolvedPath: resource.sourcePath, contentType: resource.contentType };\n\n\t\t// If extraction was used, return directly (no pagination)\n\t\tif (hasExtraction) {\n\t\t\treturn toolResult(details).text(resource.content).sourceInternal(url).done();\n\t\t}\n\n\t\tconst raw = isRawSelector(parsedSel);\n\t\tif (isMultiRange(parsedSel) && parsedSel.kind === \"lines\") {\n\t\t\treturn buildInMemoryMultiRangeResult(this.session, resource.content, parsedSel.ranges, {\n\t\t\t\tdetails,\n\t\t\t\tsourcePath: resource.sourcePath,\n\t\t\t\tsourceInternal: url,\n\t\t\t\tentityLabel: \"resource\",","sourceCodeStart":2213,"sourceCodeEnd":2249,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/read.ts#L2213-L2249","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Mount/enable the xd device in the session configuration before reading xd:// URLs.","Check session setup flags/options that populate this.session.xdev.","Use an alternative documentation source (regular files or web read) if xd is unavailable."],"exampleFix":"// before\nread(\"xd://resolution-guide\")  // session without xdev\n// after\nenableXdDevice(session); await read(\"xd://resolution-guide\")","handlingStrategy":"fallback","validationCode":"if (url.startsWith('xd://') && !session.xdev) throw new Error('xd not mounted; use an alternative source');","typeGuard":"function xdAvailable(session) { return session.xdev != null; }","tryCatchPattern":"try { return await read(url) } catch (e) { if (String(e.message).includes('not mounted')) { return fallbackDocs(name); } throw e; }","preventionTips":["Gate xd:// reads behind a check of session.xdev","Enable the xd device in session config when docs are needed","Maintain a non-xd fallback documentation path"],"tags":["read-tool","xd","missing-feature"],"backgroundTag":"resource-not-mounted","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}