GitHub Actions "working-directory ... no such file or directory"
A step fails immediately because its working-directory does not exist - the path is wrong relative to the workspace, or the directory is created later in the job than the step that cd-s into it.
What this error means
A run step errors before its command executes with a message that the working-directory does not exist, even though the command itself is valid.
Error: An error occurred trying to start process '/usr/bin/bash'
with working directory '/home/runner/work/repo/repo/app'.
No such file or directoryCommon causes
Path does not exist or is misspelled
working-directory is resolved relative to the workspace. A typo, or a subdirectory that the checkout did not create, fails before the command runs.
Directory created later than the step
Setting working-directory to a path that a prior step has not yet generated (for example a build output dir) fails because it is not there at step start.
How to fix it
Point at an existing path
Use a path relative to the repository root that exists after checkout, or set defaults.run.working-directory for the whole job.
defaults:
run:
working-directory: app
steps:
- uses: actions/checkout@v4
- run: npm ci # runs in ./appCreate the directory before using it
- Add a mkdir -p step before any step whose working-directory needs it.
- Confirm the checkout actually placed the subdirectory you expect.
- Remember working-directory does not apply to uses: steps, only run:.
How to prevent it
- Use defaults.run.working-directory for a consistent base path.
- Create generated directories before steps that cd into them.
- Keep paths relative to the repo root and verify after checkout.