can1357/oh-my-pi · error · ToolError
Glob patterns are not supported for internal URLs: ${rawPath
Error message
Glob patterns are not supported for internal URLs: ${rawPath} What it means
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.
Source
Thrown at packages/coding-agent/src/tools/path-utils.ts:1552
}
// Resolver missing or declined (e.g. ftp/ws/wss): fail explicitly
// instead of letting the local-path fallthrough surface a confusing
// "Path not found" for a URL-shaped input.
throw new ToolError(
`Cannot ${internalUrlAction} external URL: ${rawPath}. Use \`read\` to fetch web content, then search the returned text.`,
);
}
if (!internalRouter.canHandle(rawPath)) {
resolvedPathInputs.push(rawPath);
continue;
}
if (isSshUrl(rawPath)) {
throw new ToolError(
`Cannot ${internalUrlAction} a remote ssh:// path (no local file): ${rawPath}. Use \`read ${rawPath}\` to view it, or use \`grep\` on a specific remote file.`,
);
}
if (hasGlobPathChars(rawPath)) {
throw new ToolError(`Glob patterns are not supported for internal URLs: ${rawPath}`);
}
const resource = await internalRouter.resolve(rawPath, {
cwd,
settings: opts.settings,
signal: opts.signal,
sessionFile: opts.sessionFile,
localProtocolOptions: opts.localProtocolOptions,
skills: opts.skills,
// Tool-scope resolution only needs `sourcePath`; skip content
// materialization so large artifacts (or any handler that separates
// path from content) stay searchable without OOM risk.
pathOnly: true,
});
if (!resource.sourcePath) {
throw new ToolError(`Cannot ${internalUrlAction} internal URL without a backing file: ${rawPath}`);
}
if (opts.trackImmutableSources && resource.immutable) {
immutableSourcePaths.add(path.resolve(resource.sourcePath));View on GitHub (pinned to 9690622007)
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.
Example fix
// before
search({ pattern: "err", paths: ["local://runs/*.log"] })
// after
search({ pattern: "err", paths: ["local://runs/2026-08-30.log", "local://runs/2026-08-31.log"] }) Defensive patterns
Strategy: validation
Validate before calling
const GLOB_CHARS = /[*?\[{}]/;
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(p) && GLOB_CHARS.test(p)) {
throw new Error(`Remove glob characters from internal URL: ${p}`);
} Type guard
const isInternalUrlWithGlob = (p) => /^[a-z][a-z0-9+.-]*:\/\//i.test(p) && /[*?[{]/.test(p); Try / catch
try { scope = await resolveToolSearchScope(opts); }
catch (e) {
if (e.message.includes("Glob patterns are not supported for internal URLs")) {
const concrete = await listResources(p.split("://")[0]); // enumerate then search individually
return resolveToolSearchScope({ ...opts, rawPaths: concrete });
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Agent applies its usual directory-glob habits to internal URLs; users assume `issue://.../*` enumerates all issues; templated configs inject wildcards into scheme URLs.
Related errors
- Cannot ${internalUrlAction} internal URL without a backing f
- err.to_string() (invalid glob pattern)
- err.to_string() (invalid exclude glob pattern)
- memory:// URL does not contain a glob pattern: ${input}
- Glob patterns are not supported for internal URLs: ${rawPatt
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/f8a56bef78c83aa1.
Report an issue: GitHub.