can1357/oh-my-pi · error · ToolError
Glob patterns are not supported for internal URLs: ${rawPatt
Error message
Glob patterns are not supported for internal URLs: ${rawPattern} What it means
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.
Source
Thrown at packages/coding-agent/src/tools/glob.ts:220
: rawPatterns;
if (aliasResolvedPatterns.some(pattern => /^\/+$/.test(pattern))) {
throw new ToolError("Searching from root directory '/' is not allowed");
}
const internalRouter = InternalUrlRouter.instance();
const normalizedPatterns: string[] = [];
for (const rawPattern of aliasResolvedPatterns) {
if (!internalRouter.canHandle(rawPattern)) {
normalizedPatterns.push(rawPattern);
continue;
}
if (isSshUrl(rawPattern)) {
throw new ToolError(
`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.`,
);
}
if (hasGlobPathChars(rawPattern)) {
if (!/^memory:\/\//i.test(rawPattern)) {
throw new ToolError(`Glob patterns are not supported for internal URLs: ${rawPattern}`);
}
const memoryGlob = splitMemoryGlobPattern(rawPattern);
const resource = await internalRouter.resolve(memoryGlob.baseUrl, {
cwd: this.session.cwd,
settings: this.session.settings,
signal,
sessionFile: this.session.getSessionFile() ?? undefined,
localProtocolOptions: this.session.localProtocolOptions,
skills: this.session.skills,
pathOnly: true,
});
if (!resource.sourcePath) {
throw new ToolError(`Cannot find internal URL without a backing file: ${memoryGlob.baseUrl}`);
}
normalizedPatterns.push(
path.join(resource.sourcePath.replace(/[*?[{]/g, "[$&]"), memoryGlob.globPattern),
);
continue;View on GitHub (pinned to 9690622007)
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
Example fix
// before
await findTool({ path: "theme://icons/*.svg" });
// after
await findTool({ path: "memory://icons/*.svg" }); Defensive patterns
Strategy: validation
Validate before calling
const GLOB_CHARS = /[*?[{]/;
const m = /^(\w+:\/\/)/i.exec(path);
if (m && m[1].toLowerCase() !== "memory://" && GLOB_CHARS.test(path)) {
throw new Error(`strip glob chars from internal URL: ${path}`);
} Type guard
const supportsInternalGlob = (p: string): boolean => !/^\w+:\/\//i.test(p) || /^memory:\/\//i.test(p) || !/[*?[{]/.test(p); Try / catch
try {
await globTool({ path });
} catch (err) {
if (err instanceof ToolError && err.message.startsWith("Glob patterns are not supported for internal URLs")) {
await globTool({ path: path.replace(/[*?[{]/g, "") });
} else throw err;
} Prevention
- 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
When it happens
Trigger: Calling glob/find with a path like 'theme://some/*/dir' or any non-memory internal URL containing *, ?, [, or { (hasGlobPathChars true and not /^memory:\/\//i).
Common situations: Trying to wildcard-search across protocol-backed resources; assuming all internal URL schemes behave like memory://; templated paths that injected unescaped glob characters.
Related errors
- Glob patterns are not supported for internal URLs: ${rawPath
- Glob patterns are not supported for internal URLs: ${rawPath
- err.to_string() (invalid glob pattern)
- err.to_string() (invalid exclude glob pattern)
- {}: hard link not allowed for directory
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/4a530b26f1b87cdc.
Report an issue: GitHub.