Originally created by: sosidudku1
On Windows, atomic-agent fails to read %USERPROFILE%\.atomic-agent\.env with EPERM. The loader warns on stderr and continues without secrets, so stored API keys and custom base URLs are never applied. The user has to re-enter them on every launch.
Reported by a user in Discord (Windows 11, PowerShell).
PS C:\WINDOWS\system32> atomic-agent
atomic-agent: cannot read C:\Users\ben\.atomic-agent\.env: EPERM: operation not permitted, open 'C:\Users\ben\.atomic-agent\.env'
[atomic-agent] local-llm unreachable at http://127.0.0.1:8080 - starting setup...
llama-server not reachable
last error: fetch failed
[1] Local models (llama.cpp) - download and run locally
> [2] Cloud models - configure API key and pick a model
irm https://atomicagent.io/install.ps1 | iexatomic-agent, configure a cloud provider with a custom base URL and API keyThe .env file does exist (confirmed via Explorer screenshot, 1 KB, created by the agent itself in C:\Users\ben\.atomic-agent\, alongside config.json, memory.sqlite, sessions.sqlite, tasks.sqlite, analytics.json).
Reproduces in both a non-elevated and an elevated PowerShell, so this is not a simple elevation-context mismatch. Antivirus interference and broken file ACLs are still open suspects, the user's AV has not been identified yet.
src/config/load-dotenv.ts - loadDotenvFromStateDir(). Any non-ENOENT error writes a stderr warning and returns an empty result, so startup continues with no secrets loaded.
.env exists but cannot be read, show it in the TUI and say plainly that stored secrets were not loaded and why.EPERM, retry the read once and, if it fails again, print actionable guidance (icacls "%USERPROFILE%\.atomic-agent\.env" /reset, check antivirus exclusions).Set the same KEY=VALUE pairs as Windows environment variables. Shell-exported variables take priority over .env, so this bypasses the failing read entirely.
Ticket changed by: Ooooze