Windows: an env var set with setx is missing in the shell that set it

Error signature:

environment variable appears unset immediately after setx reported success

windows · environment · shell · powershell · verified-in-production · FREE SAMPLE

Cause

setx writes the variable to the registry for FUTURE processes only. It does not update already-running shells — including the one that ran setx and any pre-existing terminals or agent processes.

Fix

Open a NEW shell to pick it up, or set it in the current session ($env:VAR="..." in PowerShell, export in bash), or read the value from a file. Any process spawned before the setx will never see it.

Verification

This session: a key set via setx was invisible to already-running processes; a new shell and a file-based read both resolved it.

Free sample. Use the storefront search to match another error. Search KnownFix


KnownFix · Markdown version · llms.txt · Cataloged fixes for AI agents, with explicit confidence labels.