You ask Claude Code to fix something in page.tsx. It replies that the file does not exist. The file is open in your editor, two inches away, with unsaved changes in it.

You are looking at a tab. It is looking for an address, and the address it tried was wrong.

The idea

Your project is a tree of folders on a disk, and every AI coding tool works on that tree and nothing else. It has no concept of "the file I have open" or "the project I mean". It has a and it either resolves or it does not. Almost everything confusing about this comes from the fact that the same file has more than one correct address.

text
  /Users/tim/projects/shop          <-- the project root
  |
  |-- .env.local                     hidden (leading dot), holds secrets
  |-- .gitignore                     hidden, lists what git ignores
  |-- package.json                   what this project depends on
  |-- src/
  |   |-- app/
  |   |   |-- page.tsx               <-- this file
  |   |   \-- layout.tsx
  |   \-- lib/
  |       \-- format.ts
  \-- public/
      \-- logo.svg

  Absolute address:  /Users/tim/projects/shop/src/app/page.tsx
  From the root:     src/app/page.tsx
  From src/lib:      ../app/page.tsx

How it works

  • The project root is the folder that holds package.json (and usually .git). It is the anchor everything else is measured from. When you open a folder in VS Code or Cursor, that folder is the root the editor assumes.
  • An absolute path starts at the top of the disk: /Users/tim/projects/shop/src/app/page.tsx on macOS or Linux, C:\Users\tim\projects\shop\src\app\page.tsx on Windows. It means the same thing no matter where you are.
  • A relative path is measured from wherever the program currently is, which is its . src/app/page.tsx means "starting here". .. means "one folder up".
  • A file whose name begins with a dot is a dotfile. Finder and ls hide these by default, and they are where the important configuration lives: .env.local, .gitignore, .claude/. If you have ever been told "add it to your env file" and could not find one, this is why.

The part after the last dot is the extension: .tsx, .ts, .json, .md, .svg. Renaming styles.css to styles.txt does not change a byte inside the file. It changes what other programs assume about it, which is enough to break things, because a web server picks the content type it announces to the browser from that extension.

What to do

  1. Say where you are before you say what is wrong. pwd prints your working directory. Run it in the terminal your assistant is running in, not a different one.
  2. Give paths from the project root, not from your editor's tab bar. src/app/page.tsx is unambiguous. "the page file" is not, and neither is page.tsx in a project with nine of them.
  3. Make hidden files visible. ls -a lists them in the terminal; in Finder, Command+Shift+Period toggles them. VS Code and Cursor show them in the sidebar already.

When a file is not found, check the folder before you check the code. The usual cause is that the assistant is running one directory above or below the one you have in mind.

Where it breaks

Paths are not portable. A path that works on your Mac fails on a Linux server because Linux filenames are case sensitive and macOS usually is not. Header.tsx and header.tsx are the same file on your machine and two different files in production, which is a common way for a deploy to break code that ran locally.

Windows has its own version of this. Backslashes, drive letters and a different set of reserved filenames mean commands copied from a tutorial often fail on the first slash. Most people building web projects on Windows install WSL, Microsoft's built-in Linux environment, and work inside it, at which point every path in this section is correct again.