{"record":{"id":"f8a56bef78c83aa1","repo":"can1357/oh-my-pi","slug":"glob-patterns-are-not-supported-for-internal-urls-f8a56b","errorCode":null,"errorMessage":"Glob patterns are not supported for internal URLs: ${rawPath}","messagePattern":"Glob patterns are not supported for internal URLs: (.+?)","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/path-utils.ts","lineNumber":1552,"sourceCode":"\t\t\t}\n\t\t\t// Resolver missing or declined (e.g. ftp/ws/wss): fail explicitly\n\t\t\t// instead of letting the local-path fallthrough surface a confusing\n\t\t\t// \"Path not found\" for a URL-shaped input.\n\t\t\tthrow new ToolError(\n\t\t\t\t`Cannot ${internalUrlAction} external URL: ${rawPath}. Use \\`read\\` to fetch web content, then search the returned text.`,\n\t\t\t);\n\t\t}\n\t\tif (!internalRouter.canHandle(rawPath)) {\n\t\t\tresolvedPathInputs.push(rawPath);\n\t\t\tcontinue;\n\t\t}\n\t\tif (isSshUrl(rawPath)) {\n\t\t\tthrow new ToolError(\n\t\t\t\t`Cannot ${internalUrlAction} a remote ssh:// path (no local file): ${rawPath}. Use \\`read ${rawPath}\\` to view it, or use \\`grep\\` on a specific remote file.`,\n\t\t\t);\n\t\t}\n\t\tif (hasGlobPathChars(rawPath)) {\n\t\t\tthrow new ToolError(`Glob patterns are not supported for internal URLs: ${rawPath}`);\n\t\t}\n\t\tconst resource = await internalRouter.resolve(rawPath, {\n\t\t\tcwd,\n\t\t\tsettings: opts.settings,\n\t\t\tsignal: opts.signal,\n\t\t\tsessionFile: opts.sessionFile,\n\t\t\tlocalProtocolOptions: opts.localProtocolOptions,\n\t\t\tskills: opts.skills,\n\t\t\t// Tool-scope resolution only needs `sourcePath`; skip content\n\t\t\t// materialization so large artifacts (or any handler that separates\n\t\t\t// path from content) stay searchable without OOM risk.\n\t\t\tpathOnly: true,\n\t\t});\n\t\tif (!resource.sourcePath) {\n\t\t\tthrow new ToolError(`Cannot ${internalUrlAction} internal URL without a backing file: ${rawPath}`);\n\t\t}\n\t\tif (opts.trackImmutableSources && resource.immutable) {\n\t\t\timmutableSourcePaths.add(path.resolve(resource.sourcePath));","sourceCodeStart":1534,"sourceCodeEnd":1570,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/path-utils.ts#L1534-L1570","documentation":"Internal URL resources (session://, issue://, etc.) do not support glob patterns in resolveToolSearchScope. Glob metacharacters (`*`, `?`, `[`) in an internal URL are ambiguous — the router resolves whole resources, not globs over them — so the call is rejected up front with this ToolError.","triggerScenarios":"Passing an internal URL containing glob characters, e.g. `session://abc/transcript*.jsonl` or `local://logs/*.log`, into search-scope resolution where hasGlobPathChars(rawPath) returns true.","commonSituations":"Agent applies its usual directory-glob habits to internal URLs; users assume `issue://.../*` enumerates all issues; templated configs inject wildcards into scheme URLs.","solutions":["Remove the glob characters and target a specific internal URL resource exactly.","Enumerate the resources you need (via the scheme's listing API, e.g. session list) and pass each concrete URL as a separate scope entry.","If you need glob semantics, materialize the backing files locally (the router resolves to sourcePath) and glob over the local directory instead."],"exampleFix":"// before\nsearch({ pattern: \"err\", paths: [\"local://runs/*.log\"] })\n// after\nsearch({ pattern: \"err\", paths: [\"local://runs/2026-08-30.log\", \"local://runs/2026-08-31.log\"] })","handlingStrategy":"validation","validationCode":"const GLOB_CHARS = /[*?\\[{}]/;\nif (/^[a-z][a-z0-9+.-]*:\\/\\//i.test(p) && GLOB_CHARS.test(p)) {\n  throw new Error(`Remove glob characters from internal URL: ${p}`);\n}","typeGuard":"const isInternalUrlWithGlob = (p) => /^[a-z][a-z0-9+.-]*:\\/\\//i.test(p) && /[*?[{]/.test(p);","tryCatchPattern":"try { scope = await resolveToolSearchScope(opts); }\ncatch (e) {\n  if (e.message.includes(\"Glob patterns are not supported for internal URLs\")) {\n    const concrete = await listResources(p.split(\"://\")[0]); // enumerate then search individually\n    return resolveToolSearchScope({ ...opts, rawPaths: concrete });\n  }\n  throw e;\n}","preventionTips":["Escape or strip glob metacharacters before they reach internal-URL arguments.","Enumerate scheme resources explicitly instead of wildcarding.","Document glob support per path type in tool schemas."],"tags":["glob","internal-url","search","validation"],"backgroundTag":"glob-not-supported-for-scheme","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}