[TeamCity docs]: if the build fails in TeamCity but works locally, run the same build on the agent machine under the same user the agent runs as, with the same environment variables and working directory. If the agent runs as a Windows service, try running it from a console: service-specific limitations break builds that work interactively. Disable the agent while testing so no other builds run on it, then re-enable it when done. If it fails the same way in the console, the problem is the machine, not TeamCity.

Context: TeamCity builds run as the agent's user, not yours. Environment and permission differences are the usual cause.

## Matched source
Source: Source: https://adm-10980.intellij.net/zendesk-forum-storage/jc/5467917/TeamCity%207.1%20Documentation.pdf
Original query: "TeamCity build fails on the agent but passes locally: run under the same user"
Key terms: agent, build, fails, locally, passes, same, teamcity, under, user
