`claude --print` fails with 401 when no interactive session is open (regression in 2.1.185)

Open 💬 3 comments Opened Jun 21, 2026 by dklosterman-24

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

  1. Close Claude Code (no active interactive session)
  2. Run claude --print "hello" --dangerously-skip-permissions --output-format json from a launchd job or cron
  3. 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.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗