`claude --print` fails with 401 when no interactive session is open (regression in 2.1.185)
Description
Prior to 2.1.185, claude --print worked reliably in scheduled contexts (launchd, cron) without an active interactive Claude Code session. Starting in 2.1.185, the daemon now explicitly states "Service install is disabled in this version — the daemon runs on demand and exits when the last client disconnects." This breaks any scheduled use of --print.
Reproduction
- Close Claude Code (no active interactive session)
- Run
claude --print "hello" --dangerously-skip-permissions --output-format jsonfrom a launchd job or cron - Result:
Failed to authenticate. API Error: 401 Invalid authentication credentials
Expected behavior
--print should work for non-interactive scheduled use under a Pro subscription, as it did before 2.1.185.
Impact
Any Claude Code Pro subscriber using claude --print in scheduled automation (agents, briefing pipelines, cron jobs) is broken by this change. The previous behavior allowed Pro subscribers to use --print as a reliable non-interactive interface — the same use case the --dangerously-skip-permissions flag was designed for.
Workaround
Keep Claude Code app open at all times.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗