# Atlas edit error: File not found, or Path is a directory, not a file

> Confirm the path with the glob or read tool before editing. Relative paths resolve against the instance directory, not your shell cwd.

Atlas fails with File <path> not found, or with Path is a directory, not a file: <path>, because after resolving the path against the instance directory and clearing the external-directory check, the edit tool stats the target: a missing stat produces the not-found error, and a Directory type is rejected outright. The fix is to confirm the path with the glob or read tool before editing. Remember that relative paths resolve against the instance directory, not your shell cwd, so pass an absolute path if you are unsure which root the path is being built from. If you meant to create the file, call edit with an empty oldString or use write. If you meant to edit a file inside a directory, include the filename.

## Symptom

The edit tool fails with: File <path> not found, or with: Path is a directory, not a file: <path>.

## Cause

After resolving the path against the instance directory and clearing the external-directory check, edit stats the target. A missing stat is a not-found error, and a Directory type is rejected outright.

## Fix

1. Confirm the path with the glob or read tool before editing, so you are working from what exists rather than what you assume exists.
2. Remember that relative paths resolve against the instance directory, not your shell cwd. Pass an absolute path if you are unsure.
3. To create a file, call edit with an empty oldString, or use the write tool.
4. If you meant to edit a file inside a directory, include the filename. A bare directory path is rejected outright.
5. Re-run edit against the confirmed path and check that Atlas surfaces a unified diff for approval.

## Why does Atlas say the edit target file was not found

Atlas raises File <path> not found because the edit tool stats the target after resolving the path against the instance directory and clearing the external-directory check, and a missing stat is a not-found error. 0 files exist at the resolved path, which is not always the path you typed.

The order of operations matters for diagnosis. Atlas first resolves your path against the instance directory, then runs the external-directory containment check, and only then stats the target. So by the time you see a not-found error, the path has already been transformed into an absolute location and Atlas looked there and found nothing. The gap between the path you supplied and the path Atlas resolved is where the bug usually lives. Confirming the real path with the glob or read tool takes one call and replaces guessing with a fact. Atlas indexes code by AST declarations using tree-sitter, so glob is quick at locating the file you actually meant.

## Why does Atlas say the path is a directory, not a file

Atlas raises Path is a directory, not a file: <path> because the edit tool stats the target and rejects a Directory type outright. Atlas edits files, not folders, so the fix is 1 step: append the filename you actually meant to change to the directory path that resolved.

The directory error is more specific than the not-found error and therefore more useful, because it tells you the path resolved to something real. Common shapes: a trailing path segment that names a package rather than a module, a path built by joining a directory with a filename where the filename ended up empty, or an agent that inferred a folder from an import path and stopped there. The remedy is always the same. Append the filename, or use glob to list what is actually inside that directory and pick the right file. There is no flag that makes edit operate on a directory.

## Why relative paths resolve against the Atlas instance directory

Relative paths in Atlas resolve against the instance directory, not your shell cwd. That single fact explains a large share of File not found errors, because 1 path can resolve to 2 different places, one when you type it in your terminal and another when the Atlas edit tool builds it from the instance root. Pass an absolute path if unsure.

Do not assume the two roots agree. If a relative path is producing a not-found error that surprises you, pass an absolute path instead and the ambiguity disappears completely. Path resolution against the instance directory is also what feeds the external-directory containment check, which uses containsPath against the instance context, so the same root governs whether a path counts as inside or outside your workspace. When a path resolves somewhere unexpected and lands outside the instance context, you will see an external_directory permission prompt rather than a not-found error, which is itself a useful signal about where the path actually went.

## How to create a file in Atlas when the target does not exist

To create a file in Atlas rather than edit one, you have 2 options: call edit with an empty oldString, which is how the edit tool creates a new file, or call the write tool. A File not found error simply means nothing exists at the resolved path yet, and creating the file is a supported, explicit action.

Deciding between creation and correction is the real question when a not-found error appears. If the file genuinely should not exist yet, because you are scaffolding a new module, then creation is the intent and an empty oldString expresses it directly. If the file should exist and does not, the path is wrong and creating a new file at the wrong path only compounds the mistake, leaving you with an orphan file and the original problem intact. Confirm with glob before you decide. One glob call is much cheaper than tracking down a stray file three steps later.

## How to verify the Atlas edit path is correct

Verify by calling the Atlas read tool on the path before editing. A successful read proves the path resolves to 1 real file, which is exactly the condition the edit tool's stat is checking. Then re-run edit, and Atlas computes a unified diff for the file edit and surfaces it for approval before writing.

Reading first turns a guess into a fact, and it costs one call. If the read succeeds and edit still reports File not found, compare the exact string you passed to each tool, because a difference in the path is the only way the two can disagree once resolution is identical. If the read itself reports the path as a directory, use glob to list what is inside and select the actual file. Confirm the path before you edit rather than after: Atlas snapshots file changes as git patches, so a wrong edit can be rolled back, but a wrong file created at a wrong path is easier to avoid than to clean up.

## FAQ

### why does Atlas say file not found when editing

The Atlas edit tool stats the target after resolving the path against the instance directory and clearing the external-directory check. A missing stat is a not-found error, meaning nothing exists at the resolved path, which may differ from the path you typed.

### what does path is a directory not a file mean in Atlas

The path you supplied resolved to a real directory, and the Atlas edit tool rejects a Directory type outright. Include the filename you actually meant to edit, or use glob to list what is inside that directory.

### why does my relative path not work in Atlas edit

Relative paths in Atlas resolve against the instance directory, not your shell cwd, so a path that works in your terminal can resolve somewhere else entirely. Pass an absolute path if you are unsure which root is being used.

### how do I create a new file in Atlas when edit says not found

Call edit with an empty oldString, which is how the edit tool creates a new file, or use the write tool. Confirm the path with glob first, because creating a file at a wrong path compounds the original mistake.

### how do I check a path before editing in Atlas

Use the glob or read tool. A successful read proves the path resolves to a real file, which is the same condition the edit tool's stat check is testing, and one call replaces a guess with a fact.

### can Atlas edit a directory

No. After stating the target, Atlas rejects a Directory type outright with Path is a directory, not a file. There is no flag that makes edit operate on a folder, so include the filename.

### does Atlas check permissions before the file-not-found error

Yes. Atlas resolves the path against the instance directory, then clears the external-directory check, and only then stats the target. A path that resolved outside the workspace produces an external_directory permission prompt instead of a not-found error.

---

Canonical HTML: https://runatlas.sh/resources/troubleshooting/edit-file-not-found-or-directory
Source of truth: aeo_pages row `/resources/troubleshooting/edit-file-not-found-or-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.
