{"record":{"id":"ff2dff89a5162db5","repo":"can1357/oh-my-pi","slug":"cannot-resolve-local-url-in-bash-command-local","errorCode":null,"errorMessage":"Cannot resolve local:// URL in bash command: local protocol options are unavailable for this session.","messagePattern":"Cannot resolve local:// URL in bash command: local protocol options are unavailable for this session\\.","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/bash-skill-urls.ts","lineNumber":284,"sourceCode":"\tif (!scheme) {\n\t\tthrow new ToolError(`Unsupported internal URL in bash command: ${url}`);\n\t}\n\n\tif (scheme === \"skill\") {\n\t\treturn resolveSkillUrlToPath(url, skills);\n\t}\n\n\tif (scheme === \"attachment\") {\n\t\tconst attachment = attachments.find(entry => entry.uri === url);\n\t\tif (!attachment) {\n\t\t\tthrow new ToolError(`Unknown attachment URL in bash command: ${url}`);\n\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;","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/bash-skill-urls.ts#L266-L302","documentation":"local:// URLs can only be resolved when the session supplied LocalProtocolOptions (the mapping that turns a local:// resource into a concrete path). If resolveInternalUrlToPath is invoked without localOptions — the session doesn't support the local protocol — the tool throws immediately instead of guessing a path.","triggerScenarios":"A bash command contains a local:// URL but the BashTool/session was constructed without local protocol options (localOptions undefined), e.g. remote sessions, sessions with local protocol disabled, or tests calling expandInternalUrls without wiring LocalProtocolOptions.","commonSituations":"Using local:// URIs in an environment (remote host, restricted session, SDK embedding) where the local protocol isn't configured; forgetting to pass local protocol options when invoking the bash tool programmatically.","solutions":["Enable/configure local protocol options for the session so local:// URLs are resolvable.","Rewrite the command to use a normal filesystem path instead of a local:// URL.","Use a different supported scheme (skill://, attachment://) that is available in this session.","When embedding the tool programmatically, pass valid LocalProtocolOptions to the bash tool invocation."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"if (url.startsWith('local://') && !sessionSupportsLocalProtocol) return plainFilesystemPathInstead;","typeGuard":null,"tryCatchPattern":"try { await expandInternalUrls(cmd, ctx); } catch (e) { if (e instanceof ToolError && e.message.includes('local://')) { /* rewrite command with a direct path or enable local protocol */ } else throw e; }","preventionTips":["Only use local:// URLs in sessions configured with local protocol options.","Configure LocalProtocolOptions when embedding the bash tool if commands may contain local:// URIs.","Default to ordinary paths in generated bash commands."],"tags":["bash","local-protocol","session-config"],"backgroundTag":"protocol-handler-unavailable","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}