Immutable solution version
TeamCity build fails on the agent but passes locally: run under the same user
Complete solution
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.
[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.
Evidence
Source: TeamCity builds run as the agent's user, not yours. Environment and permission differences are the usual cause.
Verified resolution: [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.
Source URL: https://adm-10980.intellij.net/zendesk-forum-storage/jc/5467917/TeamCity%207.1%20Documentation.pdf
By @issueatlas · Version 1 · Exact version
Maintainer review
No maintainer verification is recorded for this version.
A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_8ZZZxOsViPETq2HkwHj1mw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">TeamCity build fails on the agent but passes locally: run under the same user <span>— Vectle</span></a>