{"record":{"id":"5dfa36a6aa20c0f7","repo":"can1357/oh-my-pi","slug":"cannot-find-internal-url-without-a-backing-file-5dfa36","errorCode":null,"errorMessage":"Cannot find internal URL without a backing file: ${rawPattern}","messagePattern":"Cannot find internal URL without a backing file: (.+?)","errorType":"validation","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/glob.ts","lineNumber":250,"sourceCode":"\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;\n\t\t\t\t}\n\t\t\t\tconst resource = await internalRouter.resolve(rawPattern, {\n\t\t\t\t\tcwd: this.session.cwd,\n\t\t\t\t\tsettings: this.session.settings,\n\t\t\t\t\tsignal,\n\t\t\t\t\tsessionFile: this.session.getSessionFile() ?? undefined,\n\t\t\t\t\tlocalProtocolOptions: this.session.localProtocolOptions,\n\t\t\t\t\tskills: this.session.skills,\n\t\t\t\t\tpathOnly: true,\n\t\t\t\t});\n\t\t\t\tif (!resource.sourcePath) {\n\t\t\t\t\tthrow new ToolError(`Cannot find internal URL without a backing file: ${rawPattern}`);\n\t\t\t\t}\n\t\t\t\tnormalizedPatterns.push(resource.sourcePath);\n\t\t\t}\n\t\t\tif (normalizedPatterns.some(pattern => pattern.length === 0)) {\n\t\t\t\tthrow new ToolError(\"`path` must contain non-empty globs or paths\");\n\t\t\t}\n\n\t\t\t// Tolerate missing entries in a multi-path call: skip ones whose base\n\t\t\t// directory is gone, and only error if every entry is missing. Single\n\t\t\t// missing path keeps the original ENOENT semantics — the user explicitly\n\t\t\t// asked about that one path, so silent empty results would be misleading.\n\t\t\tlet missingPaths: string[] = [];\n\t\t\tlet effectivePatterns = normalizedPatterns;\n\t\t\tif (normalizedPatterns.length > 1 && !this.#customOps) {\n\t\t\t\tconst partition = await partitionExistingPaths(normalizedPatterns, this.session.cwd, parseFindPattern);\n\t\t\t\tif (partition.valid.length === 0) {\n\t\t\t\t\tthrow new ToolError(`Path not found: ${partition.missing.join(\", \")}`);\n\t\t\t\t}","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/glob.ts#L232-L268","documentation":"Non-glob internal URL path entries are resolved to their backing file path via InternalUrlRouter.resolve with pathOnly: true. If the resolved resource has no sourcePath, there is no local file to substitute into the search, so the tool throws with the offending rawPattern in the message.","triggerScenarios":"Passing a bare internal URL (e.g. 'skill://foo' without glob chars) that resolves to a resource without a sourcePath — scheme targets without an on-disk representation.","commonSituations":"Referencing generated/virtual resources that exist only in memory; typo'd internal URLs; using a scheme whose handler doesn't map to files in the current session (missing localProtocolOptions/skills).","solutions":["Ensure the internal URL points to a file-backed resource and the session has the right localProtocolOptions/skills","Use the direct path or read tool for virtual resources that cannot be globbed","Fix the URL so InternalUrlRouter.resolve returns a resource with sourcePath"],"exampleFix":"// before\nawait findTool({ path: \"skill://virtual-resource\" }); // no backing file\n// after\nawait findTool({ path: \"skill://real-skill/README.md\" });","handlingStrategy":"type-guard","validationCode":"const resource = await internalRouter.resolve(url, { cwd, settings, signal, pathOnly: true });\nif (!resource.sourcePath) throw new Error(`no backing file for ${url}`);","typeGuard":"const hasBackingFile = (r: { sourcePath?: string | null }): r is { sourcePath: string } =>\n  typeof r.sourcePath === \"string\" && r.sourcePath.length > 0;","tryCatchPattern":"try {\n  await globTool({ path: internalUrl });\n} catch (err) {\n  if (err instanceof ToolError && /without a backing file/.test(err.message)) {\n    // use read on the virtual resource or correct the URL\n  } else throw err;\n}","preventionTips":["Only pass internal URLs that map to real files into find/glob","Check the session's localProtocolOptions/skills registration for the scheme","Fall back to the read tool for virtual resources"],"tags":["internal-url","missing-resource","path"],"backgroundTag":"internal-url-missing-backing-file","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}