{"record":{"id":"06cc71b9a8501c31","repo":"can1357/oh-my-pi","slug":"path-must-contain-non-empty-globs-or-paths","errorCode":null,"errorMessage":"`path` must contain non-empty globs or paths","messagePattern":"`path` must contain non-empty globs or paths","errorType":"validation","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/glob.ts","lineNumber":255,"sourceCode":"\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}\n\t\t\t\teffectivePatterns = partition.valid;\n\t\t\t\tmissingPaths = partition.missing;\n\t\t\t}\n\n\t\t\tconst multiPattern = await resolveExplicitFindPatterns(effectivePatterns, this.session.cwd);","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/glob.ts#L237-L273","documentation":"After normalizing all path entries (including resolved internal URLs), the tool checks that none resolved to an empty string. An empty pattern entry is unsearchable and usually signals a mangled input, so it is rejected with this ToolError before any filesystem work.","triggerScenarios":"Passing path: [''] or an entry that normalizes/resolves to '' — e.g. an empty string after alias resolution, an empty memory:// glob base, or expandDelimitedPathEntries producing a zero-length entry (e.g. a lone delimiter).","commonSituations":"Env vars or config fields defaulting to empty string and interpolated into path arrays; splitting a string like 'src/' with a pattern producing a trailing empty entry; JSON payloads with \"path\": [\"\"].","solutions":["Filter empty strings out of the path array before calling","Provide at least one non-empty glob or directory path","Fix the delimiter pattern so it doesn't yield empty segments"],"exampleFix":"// before\nawait findTool({ path: [\"\", \"src\"] });\n// after\nawait findTool({ path: [\"src\"] }); // or filter(p => p.length > 0)","handlingStrategy":"validation","validationCode":"const paths = (Array.isArray(path) ? path : [path]).map(p => (p ?? \"\").trim()).filter(p => p.length > 0);\nif (paths.length === 0) throw new Error(\"path must contain at least one non-empty entry\");","typeGuard":"const isNonEmptyPathEntry = (p: unknown): p is string => typeof p === \"string\" && p.trim().length > 0;","tryCatchPattern":"try {\n  await globTool({ path });\n} catch (err) {\n  if (err instanceof ToolError && err.message.includes(\"must contain non-empty globs or paths\")) {\n    await globTool({ path: path.filter(p => p && p.length > 0) });\n  } else throw err;\n}","preventionTips":["Filter empty strings from path arrays before calling","Guard interpolated config/env values with defaults","Check delimiter patterns don't produce empty segments"],"tags":["input-validation","path","empty-value"],"backgroundTag":"empty-path-argument","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}