Powershell: issue with '' [Console]::OutputEncoding=[System.Text.Encoding]::UTF8'
Open 💬 6 comments Opened Jan 23, 2026 by alainfrisch
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
0.89.0
What subscription do you have?
ChatGPT Business
Which model were you using?
_No response_
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
What terminal emulator and version are you using (if applicable)?
Windows Terminal, codex launched from a Cygwin terminal
What issue are you seeing?
In a given session, most actions by Codex (Ran Get-Content ..., Ran rg ...) succeed but output:
Impossible de d‚finir la propri‚t‚. La d‚finition de propri‚t‚ n'est prise en charge que sur les types principaux dans
ce mode de langage.
Au caractŠre Ligne:1 : 1
+ [Console]::OutputEncoding=[System.Text.Encoding]::UTF8;
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation : (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertySetterNotSupportedInConstrainedLanguage
Note: after the last Codex upgrade, I ran /permissions, and "installed" the new Windows sandbox. Might be related that, since the code produce this UTF-8 hasn't changed recently (last change: https://github.com/openai/codex/commit/33e1d0844a0f4871a3ee74ae601d143a242f10da)
What steps can reproduce the bug?
Bug submitted with /feedback -> thread ID 019bea83-cfa5-7a73-a0e4-99683fde7892
What is the expected behavior?
_No response_
Additional information
_No response_
6 Comments
Thanks for the bug report. It looks like this is related to a feature that we recently enabled by default to help improve UTF8 encoding in PowerShell.
Could you try disabling the feature and see if that resolves your problem? Add the following to your
config.tomlfile.Let us know if that works for you.
Thanks @etraut-openai ! I confirm that setting
powershell_utf8 = falseavoids the error message. FWIW, other features enabled in my config:In particular, I think one of the windows sandbox feature has been added by the tool (after asking me whether I want to enable a new sandbox mode for Winows) the day the problem with
powershell_utf8 = trueappeared. So perhaps an interaction between this powershell/utf8 stuff and that new sandbox? (Which resonates withPropertySetterNotSupportedInConstrainedLanguage... but I know nothing about powershell and the "constrained language"...)Just confirming noted fix works.
---
Was getting the same error in Codex reply with VS Code "Codex – OpenAI’s coding agent"
Ran Get-Date successfully; output shows Thursday, January 29, 2026 2:46:23 PM. Same constrained‑language error about [Console]::OutputEncoding appears, which looks like an environment hook. If you want, I can try another command or help track down where that encoding line is being set.
---
After adding noted change to user level config.toml
Codex now replies with
<img width="264" height="104" alt="Image" src="https://github.com/user-attachments/assets/989534a9-b9a9-4e10-b557-ad30372c000a" />
---
My current user level config.toml
My project level config.toml is empty.
Thanks.
The same error now (v0.117.0) happens even with
powershell_utf8 = false.Now seeing this error, which seems related, in all invocations of
rg:Having the same issue in the two latest versions at least (0.122.0/0.123.0).
Fresh install Codex in Windows.
<img width="731" height="245" alt="Image" src="https://github.com/user-attachments/assets/8938934d-46b2-434e-ba6a-4b3fafcece7c" />