<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: 上条碧人</title>
    <description>The latest articles on DEV Community by 上条碧人 (@kamijo_aoto).</description>
    <link>https://dev.to/kamijo_aoto</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4203592%2F70c440db-ecde-4a97-a9a3-a93a889b3869.jpg</url>
      <title>DEV Community: 上条碧人</title>
      <link>https://dev.to/kamijo_aoto</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kamijo_aoto"/>
    <language>en</language>
    <item>
      <title>40 Silent Failure Modes for Claude Code &amp; Codex CLI on Windows (Plus a One-Liner to Check Your PC)</title>
      <dc:creator>上条碧人</dc:creator>
      <pubDate>Mon, 30 Nov 2026 13:10:45 +0000</pubDate>
      <link>https://dev.to/kamijo_aoto/40-silent-failure-modes-for-claude-code-codex-cli-on-windows-plus-a-one-liner-to-check-your-pc-57kj</link>
      <guid>https://dev.to/kamijo_aoto/40-silent-failure-modes-for-claude-code-codex-cli-on-windows-plus-a-one-liner-to-check-your-pc-57kj</guid>
      <description>&lt;p&gt;When using Claude Code, Codex CLI, and the PowerShell or Python scripts underneath them on Windows, there are places where &lt;strong&gt;nothing throws an error, but the result is silently wrong&lt;/strong&gt;. An exit code changes, non-ASCII text turns into &lt;code&gt;?&lt;/code&gt;, or a hook meant to block writes lets them through.&lt;/p&gt;

&lt;p&gt;I collected 40 cases I was able to reproduce on my own Windows machine, one page per symptom. This post is the map to all 40.&lt;/p&gt;

&lt;p&gt;You can check which of the local ones reproduce on your PC with the one-liner below.&lt;/p&gt;

&lt;h2&gt;
  
  
  One-liner to check your PC
&lt;/h2&gt;

&lt;p&gt;Open &lt;strong&gt;Windows PowerShell (5.1)&lt;/strong&gt; and paste the following line. Search for "Windows PowerShell" in the Start menu (use Windows PowerShell 5.1, not PowerShell 7 or Command Prompt).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;irm&lt;/span&gt; &lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;cart231&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;ffly&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;io&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;cc&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;win&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;symptoms&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;doctor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ps1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;iex&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It runs a small check for each symptom and prints a table showing &lt;code&gt;REPRODUCED&lt;/code&gt;, &lt;code&gt;NOT REPRODUCED&lt;/code&gt;, or &lt;code&gt;CANNOT CHECK&lt;/code&gt; alongside the link to that symptom's page (&lt;code&gt;REPRODUCED&lt;/code&gt; rows are sorted to the top). &lt;code&gt;CANNOT CHECK&lt;/code&gt; means a required tool (such as Python) was not available on the machine. At the end, it prints how many of the checked items reproduced on your PC.&lt;/p&gt;

&lt;p&gt;Output language is chosen automatically: it prints English on English (non-Japanese) Windows and Japanese when Windows's UI culture or locale is Japanese. To override it explicitly, set &lt;code&gt;$env:CCDOCTOR_LANG&lt;/code&gt; to &lt;code&gt;'en'&lt;/code&gt; or &lt;code&gt;'ja'&lt;/code&gt; before running the one-liner:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="no"&gt;CCDOCTOR_LANG&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'en'&lt;/span&gt;
&lt;span class="n"&gt;irm&lt;/span&gt; &lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;cart231&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;ffly&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;io&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;cc&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;win&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;symptoms&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;doctor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ps1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;iex&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is everything the script does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creates one temporary folder under &lt;code&gt;%TEMP%&lt;/code&gt;, runs the checks inside it, and deletes that folder when finished.&lt;/li&gt;
&lt;li&gt;Uploads nothing (makes no network calls beyond fetching &lt;code&gt;doctor.ps1&lt;/code&gt; itself).&lt;/li&gt;
&lt;li&gt;Requires no administrator rights.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By default, it checks the 14 items that can be tested without calling &lt;code&gt;claude&lt;/code&gt; (&lt;code&gt;t01&lt;/code&gt;–&lt;code&gt;t12&lt;/code&gt;, &lt;code&gt;c01&lt;/code&gt;, &lt;code&gt;c02&lt;/code&gt;). Another 25 items (&lt;code&gt;t14&lt;/code&gt;, &lt;code&gt;h01&lt;/code&gt;–&lt;code&gt;h24&lt;/code&gt;) require actually running Claude Code and would count toward your Claude usage, so the one-liner skips them (each page includes a self-contained command you can run yourself). &lt;code&gt;t13&lt;/code&gt; is slow, so it is also skipped by default; run &lt;code&gt;$env:CCDOCTOR_ALL = '1'&lt;/code&gt; before the one-liner to include it.&lt;/p&gt;

&lt;p&gt;If you want to inspect the script before running it, open the &lt;code&gt;irm&lt;/code&gt; URL directly in your browser.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Locale note:&lt;/strong&gt; All 40 cases were verified on Japanese-locale Windows 11 (code page 932) with Windows PowerShell 5.1.26100 and Python 3.13.7. A few encoding traps depend on code page 932 (details below), so some checks may report &lt;code&gt;NOT REPRODUCED&lt;/code&gt; on English Windows.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The map
&lt;/h2&gt;

&lt;p&gt;Each page includes the symptom, why it happens, a fix, and a 30-second PowerShell check you can paste as is.&lt;/p&gt;

&lt;h3&gt;
  
  
  Exit codes and arguments (PowerShell)
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;ID&lt;/th&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Page&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;t01&lt;/td&gt;
&lt;td&gt;PowerShell returns exit code 1 when the script exited with 2&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/t01.html" rel="noopener noreferrer"&gt;t01&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;t02&lt;/td&gt;
&lt;td&gt;The second value passed with -File disappears without an error&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/t02.html" rel="noopener noreferrer"&gt;t02&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;t03&lt;/td&gt;
&lt;td&gt;With -File, a,b stays one string instead of an array&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/t03.html" rel="noopener noreferrer"&gt;t03&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;t10&lt;/td&gt;
&lt;td&gt;$variables in a powershell -Command one-liner vanish before it runs&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/t10.html" rel="noopener noreferrer"&gt;t10&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Other PowerShell traps
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;ID&lt;/th&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Page&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;t11&lt;/td&gt;
&lt;td&gt;Get-ChildItem -Include is ignored and every file comes back&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/t11.html" rel="noopener noreferrer"&gt;t11&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;t12&lt;/td&gt;
&lt;td&gt;Markdown backticks inside "..." turn into newlines and tabs&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/t12.html" rel="noopener noreferrer"&gt;t12&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;t13&lt;/td&gt;
&lt;td&gt;A log that is being written shows 0 bytes&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/t13.html" rel="noopener noreferrer"&gt;t13&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Character encoding
&lt;/h3&gt;

&lt;p&gt;Note that some encoding traps only reproduce on Japanese-locale Windows (code page 932): &lt;code&gt;t09&lt;/code&gt; broke under code page 932 on the author's machine, not under 65001, 437, or 1252, so its check may report &lt;code&gt;NOT REPRODUCED&lt;/code&gt; on English Windows. Similarly, &lt;code&gt;h04&lt;/code&gt; below relies on cp932's multi-byte lead byte swallowing a following backslash (though other non-UTF-8 code pages can mangle non-ASCII hook input in similar ways). Also note that &lt;code&gt;t06&lt;/code&gt; and &lt;code&gt;t07&lt;/code&gt; were tested on Python 3.13.7; Python 3.15 makes UTF-8 the default (PEP 686), so those two are not expected on 3.15 or later.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;ID&lt;/th&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Page&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;t04&lt;/td&gt;
&lt;td&gt;Non-ASCII text piped to claude -p, python or git arrives as ?&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/t04.html" rel="noopener noreferrer"&gt;t04&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;t05&lt;/td&gt;
&lt;td&gt;Output from python or claude turns into mojibake in a variable&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/t05.html" rel="noopener noreferrer"&gt;t05&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;t06&lt;/td&gt;
&lt;td&gt;Python works when run by hand but crashes under Task Scheduler or redirection&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/t06.html" rel="noopener noreferrer"&gt;t06&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;t07&lt;/td&gt;
&lt;td&gt;PYTHONIOENCODING is set, but python -I ignores it&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/t07.html" rel="noopener noreferrer"&gt;t07&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;t08&lt;/td&gt;
&lt;td&gt;A .ps1 with non-ASCII text fails to parse or prints mojibake&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/t08.html" rel="noopener noreferrer"&gt;t08&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;t09&lt;/td&gt;
&lt;td&gt;A .cmd / .bat file runs its comment text as commands&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/t09.html" rel="noopener noreferrer"&gt;t09&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Hooks (write guards)
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;ID&lt;/th&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Page&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;h01&lt;/td&gt;
&lt;td&gt;A Claude Code PreToolUse hook lets the write through when it times out&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h01.html" rel="noopener noreferrer"&gt;h01&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h02&lt;/td&gt;
&lt;td&gt;A PowerShell hook called with -Command does not block Claude Code&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h02.html" rel="noopener noreferrer"&gt;h02&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h03&lt;/td&gt;
&lt;td&gt;No Claude Code hook runs at all (disableAllHooks is still set)&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h03.html" rel="noopener noreferrer"&gt;h03&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h04&lt;/td&gt;
&lt;td&gt;A Python deny hook lets Claude Code write into a folder with a non-ASCII (Japanese) name&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h04.html" rel="noopener noreferrer"&gt;h04&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h05&lt;/td&gt;
&lt;td&gt;A Claude Code hook path written with backslashes never starts, and the write goes through (exit code 127)&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h05.html" rel="noopener noreferrer"&gt;h05&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h21&lt;/td&gt;
&lt;td&gt;If a hook's .ps1 file is missing, writes go through even with onFailure: block&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h21.html" rel="noopener noreferrer"&gt;h21&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h23&lt;/td&gt;
&lt;td&gt;A Git Bash hook that compares $PWD with file_path treats even files inside the project as outside on Windows&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h23.html" rel="noopener noreferrer"&gt;h23&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Claude Code's Bash and PowerShell tools
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;ID&lt;/th&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Page&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;h07&lt;/td&gt;
&lt;td&gt;Stopping a background Bash task in Claude Code with TaskStop leaves the processes started with &amp;amp; or a pipe running&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h07.html" rel="noopener noreferrer"&gt;h07&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h09&lt;/td&gt;
&lt;td&gt;A Claude Code Bash command containing $$( is stopped by the dangerous-removal check&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h09.html" rel="noopener noreferrer"&gt;h09&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h10&lt;/td&gt;
&lt;td&gt;On Windows, Claude Code's Bash tool turns \\ (two backslashes) into one&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h10.html" rel="noopener noreferrer"&gt;h10&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h11&lt;/td&gt;
&lt;td&gt;On Windows, a cd into %TEMP% in Claude Code's Bash tool is undone on the next call&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h11.html" rel="noopener noreferrer"&gt;h11&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h14&lt;/td&gt;
&lt;td&gt;On Windows, Claude Code's Bash tool does not run commands longer than about 7,400 characters (the error says a quote is unmatched)&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h14.html" rel="noopener noreferrer"&gt;h14&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h12&lt;/td&gt;
&lt;td&gt;Claude Code's PowerShell tool goes back to the start folder on the next call after cd&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h12.html" rel="noopener noreferrer"&gt;h12&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h20&lt;/td&gt;
&lt;td&gt;Claude Code's PowerShell tool reports success as failure because of an earlier command's exit code&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h20.html" rel="noopener noreferrer"&gt;h20&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  File writing and search (Edit, Write, Grep)
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;ID&lt;/th&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Page&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;h06&lt;/td&gt;
&lt;td&gt;Writing through a Windows 8.3 short name makes Claude Code drop the original file name&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h06.html" rel="noopener noreferrer"&gt;h06&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h16&lt;/td&gt;
&lt;td&gt;On Windows, Claude Code's Edit and Write silently change the letter case of the file name&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h16.html" rel="noopener noreferrer"&gt;h16&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h22&lt;/td&gt;
&lt;td&gt;Claude Code's Edit and Write silently strip trailing whitespace outside .md files (tabs-to-spaces just deletes the tabs)&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h22.html" rel="noopener noreferrer"&gt;h22&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h24&lt;/td&gt;
&lt;td&gt;Claude Code's Grep returns No files found for a */ glob when searching below the working folder&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h24.html" rel="noopener noreferrer"&gt;h24&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Settings and CLAUDE.md loading
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;ID&lt;/th&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Page&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;h15&lt;/td&gt;
&lt;td&gt;A partial Read of a subdirectory CLAUDE.md silently stops the rest of it from loading&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h15.html" rel="noopener noreferrer"&gt;h15&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h17&lt;/td&gt;
&lt;td&gt;Start Claude Code in a repo subfolder and the hooks in the root .claude/settings.json do not run&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h17.html" rel="noopener noreferrer"&gt;h17&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h18&lt;/td&gt;
&lt;td&gt;On Windows, Claude Code skips a subfolder's CLAUDE.md when the path's drive letter is lowercase (c:\)&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h18.html" rel="noopener noreferrer"&gt;h18&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h19&lt;/td&gt;
&lt;td&gt;Start Claude Code under a junction and the working folder is silently replaced by the real path (hooks too)&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h19.html" rel="noopener noreferrer"&gt;h19&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Running &lt;code&gt;claude -p&lt;/code&gt; unattended
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;ID&lt;/th&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Page&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;t14&lt;/td&gt;
&lt;td&gt;claude -p --allowedTools swallows the prompt after it&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/t14.html" rel="noopener noreferrer"&gt;t14&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h08&lt;/td&gt;
&lt;td&gt;After claude -w -p exits, the git worktree stays locked and cannot be removed&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h08.html" rel="noopener noreferrer"&gt;h08&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;h13&lt;/td&gt;
&lt;td&gt;claude -p --json-schema silently stops working with an --agent that restricts tools (still reports success)&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/h13.html" rel="noopener noreferrer"&gt;h13&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Codex CLI
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;ID&lt;/th&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Page&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;c01&lt;/td&gt;
&lt;td&gt;Codex CLI on PowerShell 5.1: non-ASCII text piped to a command arrives as ? (exit code 0)&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/c01.html" rel="noopener noreferrer"&gt;c01&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;c02&lt;/td&gt;
&lt;td&gt;Codex CLI on PowerShell 5.1 misreads UTF-8 (no BOM) Japanese files (exit code 0)&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/c02.html" rel="noopener noreferrer"&gt;c02&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Why they fail silently
&lt;/h2&gt;

&lt;p&gt;Looking at all 40 together, most of them fall into four recurring patterns:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Exit codes do not arrive as the number you expected.&lt;/strong&gt; &lt;code&gt;powershell -Command&lt;/code&gt; turns a script's &lt;code&gt;exit 2&lt;/code&gt; into &lt;code&gt;1&lt;/code&gt; (&lt;code&gt;t01&lt;/code&gt;). Claude Code hooks treat exit code &lt;code&gt;2&lt;/code&gt; as "block", while &lt;code&gt;1&lt;/code&gt; and &lt;code&gt;127&lt;/code&gt; are treated as non-blocking errors and execution continues. That is why a hook invoked via &lt;code&gt;-Command&lt;/code&gt; (&lt;code&gt;h02&lt;/code&gt;) or a hook that fails to start with exit &lt;code&gt;127&lt;/code&gt; due to path escaping (&lt;code&gt;h05&lt;/code&gt;) does not stop a write. And when a &lt;code&gt;-File&lt;/code&gt; &lt;code&gt;.ps1&lt;/code&gt; is missing, its exit code (&lt;code&gt;-196608&lt;/code&gt;) is treated as success (&lt;code&gt;h21&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Default encodings differ at every boundary.&lt;/strong&gt; Windows PowerShell 5.1 encodes text piped to external programs as ASCII (&lt;code&gt;t04&lt;/code&gt;), decodes native command output with the OEM code page (&lt;code&gt;t05&lt;/code&gt;), and reads &lt;code&gt;.ps1&lt;/code&gt; files without a BOM using the ANSI code page (&lt;code&gt;t08&lt;/code&gt;). When PowerShell 7 is not installed, Codex CLI runs commands through PowerShell 5.1 and hits the same defaults (&lt;code&gt;c01&lt;/code&gt;, &lt;code&gt;c02&lt;/code&gt;). On Japanese-locale Windows (code page 932), multi-byte code-page behavior adds further traps (&lt;code&gt;t09&lt;/code&gt;, &lt;code&gt;h04&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Windows paths mean different things to different layers.&lt;/strong&gt; In Git Bash, &lt;code&gt;\&lt;/code&gt; escapes the next character, so an unquoted &lt;code&gt;C:\...&lt;/code&gt; hook path breaks (&lt;code&gt;h05&lt;/code&gt;). Claude Code's Bash tool collapses &lt;code&gt;\\&lt;/code&gt; into a single &lt;code&gt;\&lt;/code&gt; before execution (&lt;code&gt;h10&lt;/code&gt;). Comparing &lt;code&gt;C:\...&lt;/code&gt; against &lt;code&gt;/c/...&lt;/code&gt; as raw strings never matches (&lt;code&gt;h23&lt;/code&gt;). 8.3 short names, letter case, and junctions also refer to the same file under different spellings (&lt;code&gt;h06&lt;/code&gt;, &lt;code&gt;h16&lt;/code&gt;, &lt;code&gt;h18&lt;/code&gt;, &lt;code&gt;h19&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Safety guards fail open.&lt;/strong&gt; When a hook times out or fails to start, Claude Code continues by default (&lt;code&gt;h01&lt;/code&gt;). You need &lt;code&gt;"onFailure": "block"&lt;/code&gt; to fail closed—and even then, a missing &lt;code&gt;.ps1&lt;/code&gt; (&lt;code&gt;h21&lt;/code&gt;) or a leftover &lt;code&gt;disableAllHooks&lt;/code&gt; setting (&lt;code&gt;h03&lt;/code&gt;) still lets writes through (each page shows the workaround).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most of these either print no error at all or report a message unrelated to the actual cause. They are easy to miss interactively and tend to surface when you run &lt;code&gt;claude -p&lt;/code&gt; or Task Scheduler unattended and find that only the output is off.&lt;/p&gt;

&lt;h2&gt;
  
  
  If you find a new one
&lt;/h2&gt;

&lt;p&gt;If you run into another silent failure on Windows that is not listed here, please open an issue on &lt;a href="https://github.com/cart231-ffly-b/cc-win-symptoms/issues" rel="noopener noreferrer"&gt;cc-win-symptoms Issues&lt;/a&gt;. If I can reproduce it on my PC, I will add a page, a check snippet, and include it in the one-liner where possible.&lt;/p&gt;

&lt;p&gt;Reports of items that no longer reproduce on your machine (for instance, fixed in a newer version) are helpful too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Related
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Full English index: &lt;a href="https://cart231-ffly-b.github.io/cc-win-symptoms/en/index.html" rel="noopener noreferrer"&gt;https://cart231-ffly-b.github.io/cc-win-symptoms/en/index.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Reproduction scripts (MIT): &lt;a href="https://github.com/cart231-ffly-b/claude-code-windows-traps" rel="noopener noreferrer"&gt;https://github.com/cart231-ffly-b/claude-code-windows-traps&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This post was written with AI (Claude). Every result on the linked pages was obtained by running the commands on the author's PC.&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>windows</category>
      <category>powershell</category>
      <category>ai</category>
    </item>
    <item>
      <title>Claude Code on Windows breaks without errors: 15 traps I reproduced</title>
      <dc:creator>上条碧人</dc:creator>
      <pubDate>Sat, 24 Oct 2026 00:53:19 +0000</pubDate>
      <link>https://dev.to/kamijo_aoto/claude-code-on-windows-breaks-without-errors-15-traps-i-reproduced-d6</link>
      <guid>https://dev.to/kamijo_aoto/claude-code-on-windows-breaks-without-errors-15-traps-i-reproduced-d6</guid>
      <description>&lt;p&gt;Running Claude Code unattended on Windows 11 with Windows PowerShell 5.1, I kept hitting failures that produced &lt;strong&gt;no error&lt;/strong&gt; — just a wrong result. I re-triggered every one of them on my machine (Windows PowerShell 5.1.26100, Python 3.13.7, Claude Code 2.1.304, October 2026).&lt;/p&gt;

&lt;p&gt;My machine runs Japanese Windows. For the traps that depend on code pages, I also re-ran the checks with the English defaults (ANSI 1252, OEM 437). Only #9 stopped breaking. The rest either broke the same way, broke differently (noted below), or do not depend on the language setting at all.&lt;/p&gt;

&lt;p&gt;To see which of #1–#14 happen on your own machine, run the free script (MIT, also a Claude Code plugin): &lt;a href="https://github.com/cart231-ffly-b/claude-code-windows-traps" rel="noopener noreferrer"&gt;https://github.com/cart231-ffly-b/claude-code-windows-traps&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The map
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;#&lt;/th&gt;
&lt;th&gt;What breaks&lt;/th&gt;
&lt;th&gt;Where you hit it&lt;/th&gt;
&lt;th&gt;What I saw&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;exit 2&lt;/code&gt; becomes &lt;code&gt;1&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;calling a script with &lt;code&gt;powershell -Command&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;-File=2 -Command=1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;an argument is silently dropped&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-File&lt;/code&gt; with &lt;code&gt;-Path a b&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;count=1&lt;/code&gt;, exit code 0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;an array becomes one string&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-File&lt;/code&gt; with &lt;code&gt;-Path a,b&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;first=a,b&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;non-ASCII arrives as &lt;code&gt;??&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;piping text into a native program&lt;/td&gt;
&lt;td&gt;bytes &lt;code&gt;3f3f&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;captured output is mojibake&lt;/td&gt;
&lt;td&gt;reading UTF-8 output with the default console encoding&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;café—&lt;/code&gt; read as &lt;code&gt;caf├⌐ΓÇö&lt;/code&gt; (cp437)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;Python crashes only when redirected&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;python x.py &amp;gt; out.txt&lt;/code&gt; printing &lt;code&gt;✓&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;UnicodeEncodeError, exit 1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;PYTHONIOENCODING&lt;/code&gt; has no effect&lt;/td&gt;
&lt;td&gt;&lt;code&gt;python -I&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;exit 1 with &lt;code&gt;-I&lt;/code&gt;, 0 without&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;an em dash becomes a syntax error&lt;/td&gt;
&lt;td&gt;non-ASCII &lt;code&gt;.ps1&lt;/code&gt; saved without BOM&lt;/td&gt;
&lt;td&gt;"string is missing the terminator"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;a &lt;code&gt;.cmd&lt;/code&gt; runs its comments (CJK Windows only)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;.cmd&lt;/code&gt; saved with LF&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;cp932=broken cp65001=ok&lt;/code&gt;; fine on 437/1252&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;a one-liner is a syntax error&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;powershell -Command "foreach ($i ...)"&lt;/code&gt; from PowerShell&lt;/td&gt;
&lt;td&gt;exit 1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-Include&lt;/code&gt; is ignored&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Get-ChildItem -LiteralPath ... -Include *.ps1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;the &lt;code&gt;.md&lt;/code&gt; came back too&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;letters vanish into newlines&lt;/td&gt;
&lt;td&gt;Markdown backticks inside &lt;code&gt;"..."&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;`n&lt;/code&gt; became a newline&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;13&lt;/td&gt;
&lt;td&gt;a growing file shows 0 bytes&lt;/td&gt;
&lt;td&gt;listing a log under &lt;code&gt;AppData&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;listed 0, actual 5,000,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;14&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;claude -p&lt;/code&gt; gets no prompt&lt;/td&gt;
&lt;td&gt;&lt;code&gt;--allowedTools Read "prompt"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Input must be provided ...&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;15&lt;/td&gt;
&lt;td&gt;a slow safety hook lets the write through&lt;/td&gt;
&lt;td&gt;a PreToolUse hook that answers after its timeout&lt;/td&gt;
&lt;td&gt;the file was written, 3 times out of 3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Three habits that cover most of them
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Measure what the screen won't show.&lt;/strong&gt; Exit codes, bytes, real file sizes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ASCII instruction + UTF-8 file.&lt;/strong&gt; Keep non-ASCII text out of pipes, arguments and &lt;code&gt;"..."&lt;/code&gt;. Tell Claude: &lt;code&gt;Read the file C:\work\prompt.md and do exactly what it says.&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run it the way it will really run&lt;/strong&gt; — through the scheduler, with &lt;code&gt;-File&lt;/code&gt; — once, before you trust it.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Each trap
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. &lt;code&gt;-Command&lt;/code&gt; turns exit code 2 into 1.&lt;/strong&gt; A script that only does &lt;code&gt;exit 2&lt;/code&gt; returned 2 with &lt;code&gt;-File&lt;/code&gt; and 1 with &lt;code&gt;-Command&lt;/code&gt;. Codes 0 and 1 pass through unchanged, so nothing looks wrong until you start using 2 or higher — Task Scheduler's "Last Run Result" shows 1 too. Use &lt;code&gt;-File&lt;/code&gt;, or append &lt;code&gt;; exit $LASTEXITCODE&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2–3. &lt;code&gt;-File&lt;/code&gt; passes arguments as plain strings.&lt;/strong&gt; &lt;code&gt;-Path a b&lt;/code&gt; silently dropped &lt;code&gt;b&lt;/code&gt; (exit code 0). Add &lt;code&gt;[CmdletBinding()]&lt;/code&gt; and the same call stops with "A positional parameter cannot be found" — stopping is safer. &lt;code&gt;-Path a,b&lt;/code&gt; stays one string &lt;code&gt;a,b&lt;/code&gt;; split it yourself with &lt;code&gt;-split ','&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Piped non-ASCII text arrives as &lt;code&gt;??&lt;/code&gt;.&lt;/strong&gt; Windows PowerShell 5.1 encodes text sent to native programs with &lt;code&gt;$OutputEncoding&lt;/code&gt;, which defaults to us-ascii. &lt;code&gt;café—&lt;/code&gt; piped to Python arrived as &lt;code&gt;caf??&lt;/code&gt;. Prompts piped into &lt;code&gt;claude -p&lt;/code&gt; get damaged the same way. Put long prompts in a UTF-8 file and send an ASCII instruction instead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Captured output turns into mojibake.&lt;/strong&gt; The reverse direction breaks too: UTF-8 output read with the default console encoding became unrelated characters — &lt;code&gt;café—&lt;/code&gt; came back as &lt;code&gt;caf├⌐ΓÇö&lt;/code&gt; under cp437 (the US default). Set &lt;code&gt;[Console]::OutputEncoding&lt;/code&gt; to UTF-8 on the reading side, and align the sending side as well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Python crashes only when redirected.&lt;/strong&gt; On screen, Windows Python prints anything. Redirected to a file, it encodes with the ANSI code page and crashes on any character outside it. With cp1252, &lt;code&gt;—&lt;/code&gt; and &lt;code&gt;é&lt;/code&gt; were fine, but &lt;code&gt;✓&lt;/code&gt; (U+2713) crashed with exit 1 — and AI-written scripts love printing ✓ and →. This is one reason scripts "work by hand but fail under the scheduler". &lt;code&gt;PYTHONIOENCODING=utf-8&lt;/code&gt; fixes it. (Python 3.15, released October 9, makes UTF-8 the default, so on 3.15 or later this is not expected. I tested on 3.13; with &lt;code&gt;-X utf8&lt;/code&gt;, the 3.15 default, the same script did not crash.)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. &lt;code&gt;python -I&lt;/code&gt; ignores &lt;code&gt;PYTHONIOENCODING&lt;/code&gt;.&lt;/strong&gt; With &lt;code&gt;-I&lt;/code&gt; (isolated mode) the crash stayed (exit 1 with &lt;code&gt;-I&lt;/code&gt;, 0 without). Drop &lt;code&gt;-I&lt;/code&gt;, or call &lt;code&gt;sys.stdout.reconfigure(encoding="utf-8")&lt;/code&gt; inside the script. This one is also not expected on Python 3.15 or later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. A BOM-less non-ASCII &lt;code&gt;.ps1&lt;/code&gt;.&lt;/strong&gt; PowerShell 5.1 reads BOM-less files with the ANSI code page. On English Windows that is worse than mojibake: the UTF-8 bytes of &lt;code&gt;—&lt;/code&gt; end in 0x94, which cp1252 reads as &lt;code&gt;”&lt;/code&gt; — and PowerShell treats curly quotes as real quotes. &lt;code&gt;Write-Output "a—b"&lt;/code&gt; saved without BOM, read as cp1252, fails to parse ("The string is missing the terminator"). Save such files as UTF-8 with BOM, or keep &lt;code&gt;.ps1&lt;/code&gt; files ASCII-only.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9. (Japanese, Chinese and Korean Windows only) A &lt;code&gt;.cmd&lt;/code&gt; with LF line endings runs its comments.&lt;/strong&gt; AI file tools usually write LF. A &lt;code&gt;.cmd&lt;/code&gt; with non-ASCII &lt;code&gt;rem&lt;/code&gt; comments, saved with LF, made cmd.exe try to execute the comment text. The same file broke under code page 932 and ran to the end under 65001 (UTF-8). Under 437 and 1252, a file with accented Latin comments ran fine. If your users include CJK Windows, save &lt;code&gt;.cmd&lt;/code&gt; files with CRLF anyway.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. A one-liner becomes a syntax error.&lt;/strong&gt; From PowerShell, &lt;code&gt;powershell -Command "foreach ($i in 1..2) { $i }"&lt;/code&gt; lets the &lt;em&gt;calling&lt;/em&gt; shell expand &lt;code&gt;$i&lt;/code&gt; (to nothing) first. The child receives &lt;code&gt;foreach ( in 1..2)&lt;/code&gt; and exits with 1. Put the logic in a &lt;code&gt;.ps1&lt;/code&gt; and run it with &lt;code&gt;-File&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;11. &lt;code&gt;-Include&lt;/code&gt; is ignored with &lt;code&gt;-LiteralPath&lt;/code&gt;.&lt;/strong&gt; In a folder with one &lt;code&gt;.ps1&lt;/code&gt; and one &lt;code&gt;.md&lt;/code&gt;, &lt;code&gt;Get-ChildItem -LiteralPath &amp;lt;dir&amp;gt; -Recurse -File -Include *.ps1&lt;/code&gt; returned both. My own health-check script hit this and flagged Markdown and JSON files as broken batch files — my test fixtures only contained scripts, so the tests never showed it. Filter extensions with &lt;code&gt;Where-Object&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;12. Backticks inside &lt;code&gt;"..."&lt;/code&gt;.&lt;/strong&gt; Inside a double-quoted PowerShell string the backtick is an escape character: Markdown like &lt;code&gt;`night-shift`&lt;/code&gt; turns &lt;code&gt;`n&lt;/code&gt; into a newline and the letter disappears. Use single-quoted here-strings for text that contains backticks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;13. A file being written shows 0 bytes.&lt;/strong&gt; A log being written by a background process listed as 0 bytes in &lt;code&gt;Get-ChildItem&lt;/code&gt;; opened, it held 5,000,000 bytes. On my machine this happened every time under &lt;code&gt;AppData&lt;/code&gt; and not under my home folder; I have not confirmed why. Open the file before concluding it is empty.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;14. &lt;code&gt;claude -p&lt;/code&gt; swallows the prompt.&lt;/strong&gt; &lt;code&gt;claude -p --allowedTools Read "say hi"&lt;/code&gt; failed with &lt;code&gt;Error: Input must be provided either through stdin or as a prompt argument when using --print&lt;/code&gt;. &lt;code&gt;--allowedTools&lt;/code&gt; and &lt;code&gt;--add-dir&lt;/code&gt; take any number of values, so they eat the prompt. Send the prompt on stdin.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;15. A safety hook that answers late lets the write through.&lt;/strong&gt; I made a PreToolUse hook that always denies, but waits 15 seconds first, with a 3-second timeout. Claude Code wrote the file anyway — no error, no warning, three runs out of three. With a 60-second timeout it was blocked. The official hooks reference says the same thing: a timed-out PreToolUse hook does not block the call, so don't count on a stalled hook as a gate. The fix is one line: add &lt;code&gt;"onFailure": "block"&lt;/code&gt; to the hook (Claude Code 2.1.295 or later). With it, the same late hook blocked the write, and so did a hook whose script was missing.&lt;/p&gt;




&lt;p&gt;I packaged the fixes as &lt;strong&gt;cc-win-kit&lt;/strong&gt;: a write guard for Claude Code (with &lt;code&gt;onFailure: "block"&lt;/code&gt;), an unattended runner with stop conditions, a doctor that finds these files and fail-open hook settings on your machine, and a script that shows the hook-timeout hole with the real &lt;code&gt;claude -p&lt;/code&gt;. It's $19: &lt;a href="https://payhip.com/b/bRnDJ" rel="noopener noreferrer"&gt;https://payhip.com/b/bRnDJ&lt;/a&gt; (the trap reproduction script itself is the free one above)&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Disclosure: this post was written with AI assistance. Claude Code ran the reproduction scripts on my Windows machine and drafted the text; the results quoted above come from those runs.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>windows</category>
      <category>powershell</category>
      <category>automation</category>
    </item>
  </channel>
</rss>
