# Atlas glob tool: "glob path must be a directory: <path>"

> To fix "glob path must be a directory" in Atlas, pass the directory to search in `path` and the file pattern in `pattern`, not the filename in `path`.

Atlas glob fails with "glob path must be a directory: <path>" because GlobTool stats the resolved search path and rejects it when the type is File, since the path is the search root and not the pattern. The fix is to pass the directory to search in `path`, and the file pattern in `pattern`. To match a single file, use a pattern like `**/name.ts` from the project root rather than putting the filename in `path`. You can also omit `path` entirely to search from the instance directory, and if what you actually want is to search file contents rather than names, use grep instead of glob.

## Symptom

The glob tool fails with: glob path must be a directory: <path>. The call returns no matches because the search root was rejected before any pattern matching happened.

## Cause

Atlas's GlobTool stats the resolved search path and rejects it when the type is File, because the path is the search root, not the pattern. Passing a filename in `path` tells glob to search inside a file, which is not something a filename glob can do.

## Fix

1. Pass the directory to search in `path`, and the file pattern in `pattern`. The two parameters have different jobs and are not interchangeable.
2. To match a single file, use a pattern like `**/name.ts` from the project root instead of naming the file in `path`.
3. Omit `path` entirely to search from the instance directory when you do not need to scope the search root.
4. Use grep instead if you want to search file contents rather than names.
5. Re-run glob and confirm the tool returns matching file paths.

## Why does Atlas say "glob path must be a directory"

Atlas says "glob path must be a directory: <path>" because GlobTool stats the resolved search path and rejects it when the type is File. GlobTool takes 2 parameters, `path` and `pattern`: `path` is the search root glob walks from, and a file is not a place you can walk from.

The mistake is a role confusion between two parameters. GlobTool takes a root and a pattern: the root says where to look, the pattern says what to match. When a filename lands in the root slot, glob is being asked to enumerate the contents of a file as if it were a directory, which is meaningless. Rather than returning an empty list and letting you wonder why your file was not found, GlobTool stats the path, sees a File, and says so. The message names the path it stated, so the offending argument is right there in the error, which makes this one of the faster tool errors to diagnose.

## How to fix the Atlas glob path error

Fix the Atlas glob error by moving the filename out of `path` and into `pattern`. Pass the directory to search in `path`, and the file pattern in `pattern`. To find 1 specific file, use a pattern like `**/name.ts` from the project root and leave `path` as a directory or omit it.

The `**/name.ts` form is the one to memorize, because it covers the case people are usually trying to express when they put a filename in `path`. The `**/` prefix means any depth of directory, so the pattern finds the file wherever it lives in the tree without you needing to know its parent. That is almost always what you wanted: you know the filename, you do not know the folder, and that is exactly the gap glob was built to close. Omitting `path` entirely is the simplest correct call when you have no reason to narrow the root. The search then starts from the instance directory, and the pattern does all the work.

## When to omit the Atlas glob path parameter

Omit the `path` parameter in Atlas glob whenever you do not need to scope the search root. With `path` omitted, glob searches from the instance directory, and the pattern alone decides what matches. 1 fewer argument means 1 fewer chance to pass the wrong kind of value.

Setting `path` is worth doing when the repository is large and you know the file lives under one package or one subtree, because narrowing the root makes the search cheaper and the results more relevant. Setting it out of habit, on a call where you do not actually know the directory, is how a filename ends up in the root slot in the first place. The rule of thumb: set `path` only when you can name the directory with confidence. Otherwise leave it out and let the pattern find the file. Atlas indexes code by AST declarations using tree-sitter, not blind line windows, so once glob hands you a real path, the deeper search tools have plenty to work with.

## Should I use glob or grep in Atlas

Use Atlas glob when you are looking for files by name, and use grep when you are looking for code by content. Those are 2 different questions, and passing a filename to glob's `path` parameter usually means you wanted to look inside that file, which is grep's job.

The distinction is worth internalizing because it eliminates the error entirely rather than fixing it after the fact. Glob answers "where is the file called X". Grep answers "which lines say X". If your goal is to find a function definition, a config key, or an error string, glob is the wrong door no matter how you shape the arguments, and grep gets you there in one call. Atlas searches code with hybrid semantic and keyword retrieval fused by reciprocal rank fusion, so content search is a first-class capability rather than a fallback. Reach for names with glob, contents with grep, and the "glob path must be a directory" error stops appearing.

## How to verify the Atlas glob fix worked

Verify the Atlas glob fix by re-running the tool. A correctly shaped call returns a list of matching file paths and does not print "glob path must be a directory: <path>". If the call succeeds but returns 0 files, the arguments are now valid and the pattern is simply not matching.

Those are two different states and it is worth telling them apart. A rejected call means the search root was wrong. An empty result means the search root was fine and the pattern found no files, which points at the pattern rather than the path. Widen the pattern, add a `**/` prefix so it matches at any depth, or drop the `path` scope so the search covers the whole instance directory. If a pattern that should obviously match still returns nothing, check that the file is not excluded by a permission rule, since every Atlas tool call is permission-gated against allow, ask, and deny rules before it runs.

## FAQ

### what does glob path must be a directory mean in Atlas

Atlas's GlobTool stats the resolved search path and rejects it when the type is File. The `path` parameter is the search root, so passing a filename to it is invalid.

### how do I search for one specific file with Atlas glob

Use a pattern like `**/name.ts` from the project root. Put the filename in `pattern`, not in `path`, and leave `path` as a directory or omit it entirely.

### what is the difference between path and pattern in Atlas glob

`path` is the directory glob searches from, the search root. `pattern` is the file glob it matches names against. Putting a filename in `path` produces the glob path must be a directory error.

### can I omit the path parameter in Atlas glob

Yes. Omit `path` entirely to search from the instance directory. That is the simplest correct call when you do not need to narrow the search root.

### should I use glob or grep to search code in Atlas

Use glob to find files by name and grep to search file contents. If you want to search inside a file rather than locate it, grep is the right tool.

### why does my Atlas glob return no results after I fixed the path

A valid call that returns nothing means the pattern is not matching, not that the path is wrong. Widen the pattern, add a `**/` prefix so it matches at any depth, or remove the `path` scope.

### how do I confirm my Atlas glob call is fixed

Re-run it. A correctly shaped call returns matching file paths and no longer prints glob path must be a directory: <path>.

---

Canonical HTML: https://runatlas.sh/resources/troubleshooting/glob-path-must-be-a-directory
Source of truth: aeo_pages row `/resources/troubleshooting/glob-path-must-be-a-directory` (segment: Troubleshooting) (this file is generated from it, never hand-edited).
Licence: Atlas is proprietary with a free core. It is not open source and there is no public source repository.
