{"record":{"id":"4f2041e69b2671d2","repo":"can1357/oh-my-pi","slug":"cannot-resolve-scheme-url-in-bash-command","errorCode":null,"errorMessage":"Cannot resolve ${scheme}:// URL in bash command: ${url}\nInternal URL router is unavailable for this protocol in the current session.","messagePattern":"Cannot resolve (.+?):// URL in bash command: (.+?)\nInternal URL router is unavailable for this protocol in the current session\\.","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/bash-skill-urls.ts","lineNumber":296,"sourceCode":"\t\t}\n\t\treturn path.resolve(attachment.sourcePath);\n\t}\n\n\tif (scheme === \"local\") {\n\t\tif (!localOptions) {\n\t\t\tthrow new ToolError(\n\t\t\t\t\"Cannot resolve local:// URL in bash command: local protocol options are unavailable for this session.\",\n\t\t\t);\n\t\t}\n\t\tconst resolvedLocalPath = resolveLocalUrlToPath(url, localOptions);\n\t\tif (ensureLocalParentDirs) {\n\t\t\tawait fs.mkdir(path.dirname(resolvedLocalPath), { recursive: true });\n\t\t}\n\t\treturn resolvedLocalPath;\n\t}\n\n\tif (!internalRouter?.canHandle(url)) {\n\t\tthrow new ToolError(\n\t\t\t`Cannot resolve ${scheme}:// URL in bash command: ${url}\\n` +\n\t\t\t\t\"Internal URL router is unavailable for this protocol in the current session.\",\n\t\t);\n\t}\n\n\tlet resource: InternalResource;\n\ttry {\n\t\tresource = await internalRouter.resolve(url, { cwd, pathOnly: true, sessionFile });\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\tthrow new ToolError(`Failed to resolve ${scheme}:// URL in bash command: ${url}\\n${message}`);\n\t}\n\n\tif (!resource.sourcePath) {\n\t\tthrow new ToolError(`${scheme}:// URL resolved without a filesystem path and cannot be used in bash: ${url}`);\n\t}\n\n\treturn path.resolve(resource.sourcePath);","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/bash-skill-urls.ts#L278-L314","documentation":"For any scheme other than skill/attachment/local, resolution is delegated to the session's internal URL router. If no router is wired into the session, or the router's canHandle(url) returns false for this scheme, the tool throws this ToolError saying the router is unavailable for that protocol.","triggerScenarios":"A bash command references a custom/router scheme (e.g. some-plugin://resource) but internalRouter is undefined, or the router does not register a handler for that URL/scheme in the current session.","commonSituations":"Using an extension scheme provided by a plugin that isn't loaded in this session; running in a stripped-down/embedded session without the internal URL router; typo in the scheme so it doesn't match any registered handler.","solutions":["Load/enable the plugin or extension that registers a handler for this scheme in the session.","Verify the scheme spelling matches a handler the router registers (canHandle).","Use a built-in scheme (skill://, attachment://, local://) or a direct filesystem path instead.","Check session configuration so the internal URL router is constructed and passed to the bash tool."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"if (internalRouter && !internalRouter.canHandle(url)) throw new Error(`No handler for ${url}`);","typeGuard":null,"tryCatchPattern":"try { await expandInternalUrls(cmd, ctx); } catch (e) { if (e instanceof ToolError && /Internal URL router is unavailable/.test(e.message)) useBuiltinSchemeOrPath(e); else throw e; }","preventionTips":["Ensure plugins that register custom URL schemes are loaded before running commands that use them.","Stick to built-in schemes (skill://, attachment://, local://) unless a handler is known to exist.","Check router.canHandle(url) when constructing commands programmatically."],"tags":["bash","url-router","plugin"],"backgroundTag":"protocol-handler-unavailable","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}