{"record":{"id":"4a530b26f1b87cdc","repo":"can1357/oh-my-pi","slug":"glob-patterns-are-not-supported-for-internal-urls","errorCode":null,"errorMessage":"Glob patterns are not supported for internal URLs: ${rawPattern}","messagePattern":"Glob patterns are not supported for internal URLs: (.+?)","errorType":"validation","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/glob.ts","lineNumber":220,"sourceCode":"\t\t\t\t: rawPatterns;\n\t\t\tif (aliasResolvedPatterns.some(pattern => /^\\/+$/.test(pattern))) {\n\t\t\t\tthrow new ToolError(\"Searching from root directory '/' is not allowed\");\n\t\t\t}\n\t\t\tconst internalRouter = InternalUrlRouter.instance();\n\t\t\tconst normalizedPatterns: string[] = [];\n\t\t\tfor (const rawPattern of aliasResolvedPatterns) {\n\t\t\t\tif (!internalRouter.canHandle(rawPattern)) {\n\t\t\t\t\tnormalizedPatterns.push(rawPattern);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (isSshUrl(rawPattern)) {\n\t\t\t\t\tthrow new ToolError(\n\t\t\t\t\t\t`find cannot operate on a remote ssh:// path: ${rawPattern}. ssh:// has no local file to glob; use \\`read ${rawPattern}\\` to list or inspect the remote path.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (hasGlobPathChars(rawPattern)) {\n\t\t\t\t\tif (!/^memory:\\/\\//i.test(rawPattern)) {\n\t\t\t\t\t\tthrow new ToolError(`Glob patterns are not supported for internal URLs: ${rawPattern}`);\n\t\t\t\t\t}\n\t\t\t\t\tconst memoryGlob = splitMemoryGlobPattern(rawPattern);\n\t\t\t\t\tconst resource = await internalRouter.resolve(memoryGlob.baseUrl, {\n\t\t\t\t\t\tcwd: this.session.cwd,\n\t\t\t\t\t\tsettings: this.session.settings,\n\t\t\t\t\t\tsignal,\n\t\t\t\t\t\tsessionFile: this.session.getSessionFile() ?? undefined,\n\t\t\t\t\t\tlocalProtocolOptions: this.session.localProtocolOptions,\n\t\t\t\t\t\tskills: this.session.skills,\n\t\t\t\t\t\tpathOnly: true,\n\t\t\t\t\t});\n\t\t\t\t\tif (!resource.sourcePath) {\n\t\t\t\t\t\tthrow new ToolError(`Cannot find internal URL without a backing file: ${memoryGlob.baseUrl}`);\n\t\t\t\t\t}\n\t\t\t\t\tnormalizedPatterns.push(\n\t\t\t\t\t\tpath.join(resource.sourcePath.replace(/[*?[{]/g, \"[$&]\"), memoryGlob.globPattern),\n\t\t\t\t\t);\n\t\t\t\t\tcontinue;","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/glob.ts#L202-L238","documentation":"Internal URLs (routed via InternalUrlRouter) cannot contain glob metacharacters — except memory://, which has special glob splitting support. Any other internal scheme with '*', '?', '[', etc. is rejected because those backends have no filesystem semantics to match against.","triggerScenarios":"Calling glob/find with a path like 'theme://some/*/dir' or any non-memory internal URL containing *, ?, [, or { (hasGlobPathChars true and not /^memory:\\/\\//i).","commonSituations":"Trying to wildcard-search across protocol-backed resources; assuming all internal URL schemes behave like memory://; templated paths that injected unescaped glob characters.","solutions":["Remove glob characters and reference the internal URL directly","Use the memory:// scheme if glob-style matching over a backing directory is intended","Escape or strip metacharacters from the URL before passing it"],"exampleFix":"// before\nawait findTool({ path: \"theme://icons/*.svg\" });\n// after\nawait findTool({ path: \"memory://icons/*.svg\" });","handlingStrategy":"validation","validationCode":"const GLOB_CHARS = /[*?[{]/;\nconst m = /^(\\w+:\\/\\/)/i.exec(path);\nif (m && m[1].toLowerCase() !== \"memory://\" && GLOB_CHARS.test(path)) {\n  throw new Error(`strip glob chars from internal URL: ${path}`);\n}","typeGuard":"const supportsInternalGlob = (p: string): boolean => !/^\\w+:\\/\\//i.test(p) || /^memory:\\/\\//i.test(p) || !/[*?[{]/.test(p);","tryCatchPattern":"try {\n  await globTool({ path });\n} catch (err) {\n  if (err instanceof ToolError && err.message.startsWith(\"Glob patterns are not supported for internal URLs\")) {\n    await globTool({ path: path.replace(/[*?[{]/g, \"\") });\n  } else throw err;\n}","preventionTips":["Keep glob metacharacters out of non-memory internal URLs","Escape templated path segments that may contain * or ?","Use memory:// when you intentionally need glob semantics over a backing dir"],"tags":["glob","internal-url","unsupported-operation"],"backgroundTag":"glob-not-supported-for-url-scheme","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}