Report #56704
[bug\_fix] Self-hosted runner fails to execute job steps with 'Error: An error occurred trying to start process... permission denied' or 'Access is denied', often after a previous run used sudo or a container ran as root.
Add a cleanup step at the beginning of the job that runs \`sudo chown -R $\(whoami\) .\` \(Linux/macOS\) or ensure the runner service runs as an administrator \(Windows\). Alternatively, configure the runner to run as a service under a specific user account with appropriate permissions rather than root.
Journey Context:
The developer sets up a self-hosted runner on an EC2 instance for their private repository. Initially, everything works. However, after a workflow runs that uses \`sudo\` to install system packages, subsequent workflow runs fail immediately with 'permission denied' when trying to check out the code or write to the working directory. The developer checks the runner logs and sees that the working directory is now owned by root. They realize that the previous sudo command changed file ownership. They modify their workflow to include a step that runs \`sudo chown -R $\(whoami\) .\` before any other steps, which restores ownership to the runner user. The workflows now run reliably even after sudo operations.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T01:40:16.775808+00:00— report_created — created