Claude Code “Raw Mode Is Not Supported” Error: Fix for Pipes and Scripts

Claude Code “Raw Mode Is Not Supported” Error: Fix for Pipes and Scripts

The Claude Code raw mode is not supported error means you started the interactive version of Claude Code somewhere that has no keyboard to read from. That usually happens when you pipe text into claude, redirect its input, or run it from cron, a CI job or another program. The interactive screen needs a real terminal, and in those places there isn’t one.

The quick fix is to add -p. Run claude -p "your question" or cat file.txt | claude -p "your question", and Claude Code prints the reply and exits without needing a keyboard. If you actually want to chat, start claude straight from a terminal window with no pipe in front of it.

If the error showed up while installing Claude Code, the fix is different: rerun the official installer. Current versions also replace the old “Raw mode” wording with a clearer “Claude Code can’t read the keyboard here” message, so running claude update helps you see what is really going on.

Browse all our Claude Code tutorials for more fixes and how-tos.

Tested with Claude Code v2.1.328 on macOS on November 21, 2026. We reproduced the no-terminal case in a throwaway demo folder with a small notes file, then ran each fix. Every terminal capture below is real output from that session.

We tested on macOS; the Windows and Linux steps follow Anthropic’s official instructions.

Quick Summary

QuestionShort answer
What the error meansInteractive claude had no terminal to read your keys from
Typical triggersPipes, redirects, cron, CI runners, apps that launch claude
Fix for scriptsAdd -p: claude -p "question"
Fix for chattingRun claude directly in a terminal
Fix during installRerun the official installer
Newer message (v2.1.287+)Claude Code can’t read the keyboard here
Exit code when it stops1
macOS and Linux bonusecho "hi" | claude works in a real terminal

What “Raw Mode Is Not Supported” Means in Claude Code

When you run plain claude, it opens a full-screen interactive session. To react to every key you press, such as arrows, Esc and Ctrl+C, that screen puts the terminal into “raw mode”. Raw mode only exists on a real terminal device.

Pipe text into claude, and its standard input (stdin) becomes the pipe instead of your keyboard. A pipe can’t switch into raw mode. Older builds of Claude Code tried anyway and failed.

Anthropic’s error reference says that before v2.1.287, Claude Code started the interface in this situation and then either showed nothing on screen or failed with an error containing “Raw mode is not supported”. Newer versions check first and explain the problem in plain words.

Claude Code error reference explaining that before v2.1.287 Claude Code failed with an error containing Raw mode is not supported
The error reference: older versions showed a blank screen or the “Raw mode is not supported” error.

Raw mode needs a keyboard. If nobody is typing, use claude -p.

We Reproduced the Error on v2.1.328

On a Mac, piping text into claude from a normal terminal doesn’t fail anymore. To see the error, we needed a setup with no terminal at all, which is exactly what cron jobs and CI runners give a program.

We wrote a tiny helper, detach.py, that starts a command in a new session with no controlling terminal. It’s four lines of Python using os.setsid(), and it imitates what a scheduler does:

#!/usr/bin/env python3
# Runs a command with no controlling terminal, like cron or a CI runner does.
import os, sys
os.setsid()
os.execvp(sys.argv[1], sys.argv[1:])

The message you see today

Then we piped a word into interactive claude through that helper:

echo 'hi' | ./detach.py claude; echo "exit code: $?"
Terminal showing Claude Code can't read the keyboard here because stdin is not a terminal and /dev/tty couldn't be opened, exit code 1
Our test on v2.1.328: no terminal, so Claude Code explains why and exits with code 1.

Claude Code printed three lines in red and stopped with exit code 1:

  1. “Claude Code can’t read the keyboard here”, followed by the reason: stdin is piped, and /dev/tty couldn’t be opened.
  2. “Start claude directly from a terminal.”
  3. A hint to add -p, which also works with --continue and --resume.

This is the modern form of the raw mode error. If you are on an older build, the same situation gives you a blank screen or the “Raw mode is not supported” text instead. Either way, the cause and the fixes are the same.

Why macOS and Linux usually still work

The docs explain a platform difference. On macOS and Linux, Claude Code reads your keystrokes from /dev/tty and starts the session, using any piped text as your first prompt. You only see the message when /dev/tty can’t be opened, as in our cron-like test.

Claude Code docs explaining that on macOS and Linux Claude Code reads keystrokes from /dev/tty while Windows exits with code 1
The docs: Windows stops with code 1, while macOS and Linux fall back to /dev/tty when they can.

On Windows, Claude Code prints the message and exits with code 1 whenever stdin is piped or redirected. Its wording names Windows Terminal, PowerShell and Command Prompt instead of /dev/tty, and it can’t fall back to the console for input yet.

How Piped Input Reaches Claude Code

Three things decide what happens: whether you used -p, whether a terminal is attached, and which version you run. This diagram puts them in order.

Diagram of what happens when you pipe text into claude: print mode with -p, interactive session with /dev/tty, or the can't read the keyboard message
With -p you always get print mode. Without it, a terminal decides whether the session can start.

Common places the error appears

  • A shell script that runs cat notes.md | claude and expects an answer back.
  • A cron job or macOS launch agent that calls claude on a schedule.
  • A CI pipeline step, a Docker container started without a TTY, or a git hook.
  • An editor task runner or another app that launches claude with its own input stream.
  • The install script, when it runs claude install from curl ... | bash on older versions.

How to Fix “Raw Mode Is Not Supported” in Claude Code

Start with where you saw the error, then pick the matching fix. Most people only need Fix 1.

Decision diagram for fixing Claude Code raw mode is not supported: rerun the installer, add -p, run claude in a terminal, or update
Pick your fix: installer, script, chat, or an old version.

Fix 1: Add -p for scripts and pipes

The -p flag (short for --print) runs Claude Code in non-interactive mode. The headless docs say this mode reads stdin, so you can pipe data in and redirect the reply out. No keyboard is needed.

cat notes.txt | claude -p 'Turn these notes into a 3-item checklist'
Terminal showing cat notes.txt piped into claude -p printing a three-item checklist and exit code 0
Our run: the notes went in through the pipe, the checklist came out, and the exit code was 0.

The piped text and the prompt argument are combined, so Claude saw both the file and the instruction. To prove the fix also works where the error happened, we ran it through the same no-terminal helper:

cat notes.txt | ./detach.py claude -p 'Which item is due Friday? One line.'
Terminal showing claude -p answering through detach.py with no terminal attached and exit code 0
Same cron-like setup as the failing run, now with -p: an answer and exit code 0.

For scripts that parse the result, add --output-format json. Our guide to Claude Code headless mode walks through the output formats and more -p patterns.

Claude Code headless docs section Pipe data through Claude saying non-interactive mode reads stdin
The headless docs confirm that non-interactive mode reads stdin.

Fix 2: Keep the conversation going with –continue

Some scripts need more than one turn. The error message itself points out that -p works with --continue and --resume <session-id>, so you can keep a thread across several calls:

claude -p "Summarize notes.txt"
echo "Now list only the items due this week" | claude -p --continue

Use --resume with a session ID when a script runs several conversations side by side and you need to pick a specific one.

Fix 3: Run claude directly in a terminal to chat

If you wanted the full interactive session, remove whatever sits in front of claude. Open Terminal, iTerm, Windows Terminal or PowerShell, cd into your project, and type claude with no pipe and no < redirect.

On macOS and Linux, a pipe from a real terminal is fine too. We ran this in a normal terminal window:

echo 'Summarize notes.txt in one short line' | claude
Interactive Claude Code session where piped text became the first prompt and Claude answered, then waited for more input
On macOS, the piped line became the first prompt and the session stayed open for more questions.

Claude Code asked us to trust the folder first, as it does for any new folder, then answered and waited for our next message. The gray “fix the typo in README” line is just a suggested follow-up, not something we typed. This trick won’t work on Windows yet; use -p there.

Fix 4: Rerun the installer if the error appeared during install

The install docs describe a separate cause. When an organization’s server-managed settings include changes that need security approval, Claude Code versions before 2.1.246 tried to show the approval dialog during claude install. The installer runs from a pipe, so the dialog failed with “Raw mode is not supported”.

Claude Code troubleshoot install docs section Raw mode is not supported during install
The install docs: v2.1.246 and later skip the approval dialog during install and update.

Rerunning the installer gets past it, because the script runs the latest release’s install command. Use the one for your platform:

# macOS and Linux
curl -fsSL https://claude.ai/install.sh | bash

# Windows PowerShell
irm https://claude.ai/install.ps1 | iex

Then check the result with claude --version. The install troubleshooting page adds one exception: if your organization’s startup config waits for the settings fetch, for example with forceRemoteSettingsRefresh, an install run from a pipe can still fail. In that case, talk to whoever manages your Claude Code settings.

Fix 5: Update so you get the clear message

If you still see a blank screen or the old wording, you are on a version older than 2.1.287. Check and update:

claude --version
claude update

Updating won’t make interactive mode work without a terminal, but the new message tells you exactly why it stopped. If claude update itself gives you trouble, our guide on updating Claude Code covers the usual fixes.

Real Examples: Scripts, Cron and CI

Here is how the same fix looks in the places where this error usually shows up.

A shell script

#!/bin/bash
# summarize-log.sh
tail -n 200 build.log | claude -p "Explain the first error in two sentences" > summary.txt

A cron job

# crontab -e
0 9 * * 1 cd ~/projects/site && claude -p "List TODO comments in src/" > ~/todo-report.txt 2>&1

Cron has no terminal, so interactive claude would stop with exit code 1. With -p, the job runs and the report lands in the file. Remember that cron uses a short PATH, so you may need the full path to claude.

A CI step

CI runners also lack a terminal, and they need a way to sign in. Our CI/CD pipeline example shows a working setup, and the guide to headless auth explains the login side. For GitHub specifically, see our GitHub Actions guide.

Where you run itHas a terminal?What to use
Terminal windowYesclaude or claude -p
Pipe in a terminal (Mac, Linux)Yes, via /dev/ttyecho "..." | claude works
Pipe on WindowsNo for inputclaude -p
Cron, launch agentsNoclaude -p
CI, Docker without TTYNoclaude -p
curl ... | bash installerNoRerun the installer

Try It Yourself

You can see the difference in under a minute. In any small folder you trust, make a notes file and compare the two commands:

printf 'buy milk\ncall the bank\nrenew passport\n' > notes.txt
cat notes.txt | claude -p "Which task is most urgent? One line."
echo "exit code: $?"

Then, if you are on macOS or Linux, try the interactive version from the same terminal and type /exit when you are done:

echo "Sort the tasks in notes.txt by urgency" | claude

If a script of yours keeps failing, you can also paste it into a working Claude Code session with this prompt:

This script runs claude without a terminal and fails with "Raw mode is not
supported" or "can't read the keyboard here". Rewrite every claude call to use
-p with the prompt as an argument, keep the same inputs and outputs, and
explain each change in one line.

Common Mistakes

  • Piping into plain claude inside a script and expecting it to print an answer. Without -p, it tries to open the full interactive screen.
  • Adding < /dev/null or < input.txt to “fix” a hang. That is still a redirect, and interactive mode still needs a keyboard.
  • Testing a cron command in your terminal, seeing it work, and assuming cron will behave the same. Your terminal has a TTY; cron doesn’t.
  • Assuming the Mac pipe trick works on Windows. On Windows, piped input to interactive claude exits with code 1.
  • Sending an empty prompt from a variable. With -p, a whitespace-only prompt fails with “Input contained only whitespace”, so check the variable first.

Pro Tips

  • Check the exit code in scripts with $?. A 1 after a bare claude call is a strong sign this is your problem.
  • Piped stdin for -p is capped at 10MB, per the headless docs. For bigger files, mention the file path in the prompt instead of piping it.
  • Use --output-format json when another program reads the reply, so you parse fields instead of text.
  • If an error message doesn’t match this one, our roundup of common Claude Code errors covers the others.
  • If claude isn’t found at all in cron or CI, see our fix for command not found.

Cheat Sheet

Cheat sheet of commands to fix Claude Code raw mode is not supported in pipes, scripts, cron, CI and the installer
Every command from this guide on one card.

Frequently Asked Questions

What does “Raw mode is not supported” mean in Claude Code?

It means interactive Claude Code tried to read your keystrokes from something that isn’t a terminal, such as a pipe or a redirect. Use claude -p for scripts, or run claude directly in a terminal.

Why don’t I see “Raw mode” anymore?

Since v2.1.287, Claude Code checks first and prints “Claude Code can’t read the keyboard here” instead. Older versions showed a blank screen or the raw mode error.

Can I pipe text into interactive Claude Code?

On macOS and Linux, yes, from a real terminal: the piped text becomes your first prompt, as we saw in our test. On Windows, or anywhere without a terminal, use -p.

How do I run Claude Code from cron or CI?

Always use claude -p with the prompt as an argument or on stdin. Make sure the job can find the claude binary and has a way to sign in.

I got the error while installing. What now?

Rerun the official installer for your platform, then check claude --version. Versions 2.1.246 and later skip the approval dialog that caused it during install.

Conclusion

The Claude Code raw mode is not supported error is not a bug in your project; it simply means interactive Claude Code had no keyboard to read from. In our test on v2.1.328, a cron-like run with no terminal stopped with a clear message and exit code 1, while the same run with -p answered and exited with code 0. Add -p in scripts, pipes, cron and CI, start claude straight from a terminal when you want to chat, rerun the installer if the error came during install, and update so you get the clearer message. To learn more about the model behind the tool, see our overview of Claude AI.

Newsletter

New AI tools in your inbox

The best new tools and the AI news that matters, in one short email. Unsubscribe any time.

Free · No spam · Unsubscribe any time

✓ Looks like you’re subscribed

Loading Google’s sign-up form…

Looks like you’re already subscribed

Thanks for reading! New AI tools and the AI news that matters will land in your inbox.

Not subscribed yet? Refresh the page to load the sign-up form.

The sign-up form couldn’t load. If you use an ad or content blocker, allow news.google.com and reload the page.

Free instant check before you pay. Takes a few seconds.

Scroll to Top