Azure Pipelines "You have an existing checkout in the current directory"
A checkout step found the working directory already populated from a previous checkout in the same job. Either you have multiple checkout steps into the same path, or a self-hosted agent kept a stale workspace.
What this error means
A checkout step fails with You have an existing checkout in the current job directory, telling you to clean or use a distinct path. It commonly appears on self-hosted agents that reuse the workspace, or when checking out multiple repos.
##[error]You have an existing checkout in the current job directory.
Please clean the current job's working directory or specify a different
path for the checkout.Common causes
Multiple repos checked out to the same path
Checking out more than one repository without giving each a distinct path collides in the default sources directory.
Stale workspace on a self-hosted agent
Self-hosted agents reuse the working directory between runs. A leftover checkout from a prior job conflicts with the new one unless the workspace is cleaned.
How to fix it
Give each checkout a distinct path
When checking out multiple repos, set path per checkout so they don’t collide.
steps:
- checkout: self
path: s/app
- checkout: git://OtherProject/tools
path: s/toolsClean the workspace on self-hosted agents
Enable workspace cleaning so each run starts fresh.
jobs:
- job: build
workspace:
clean: all # outputs | resources | all
steps:
- checkout: selfHow to prevent it
- Set
workspace: { clean: all }on jobs running on reused self-hosted agents. - Assign a unique
pathto each repo when using multiple checkouts. - Avoid duplicate
checkoutsteps targeting the same directory.