Skip to content

fix(batch): point an inactive subscription to Billing, not to re-login - #45

Draft
emirlan-zen wants to merge 2 commits into
mainfrom
batch-explain-inactive-subscription
Draft

emirlan-zen wants to merge 2 commits into
mainfrom
batch-explain-inactive-subscription

Conversation

@emirlan-zen

Copy link
Copy Markdown
Contributor

What changes

The Batch API now returns 401 with code: subscription_inactive when the API key is valid but the subscription is past due, unpaid, incomplete or paused. The CLI treated every Batch 401 as a bad key and suggested zenrows login, which can't fix a billing problem.

For subscription_inactive, the CLI now explains that the key is valid and points to Billing, or to Azure Marketplace for subscriptions bought there. It no longer suggests logging in again.

Compatibility

The error code stays AUTH_INVALID for every 401, so scripts and agents that branch on it behave as before. Only message, likely_cause and next_action change, and only for subscription_inactive. Every other 401 keeps the same text and the zenrows login suggestion.

Tests

  • New unit tests in tests/batch-api.test.ts:
    • unauthenticated keeps the re-login guidance
    • subscription_inactive keeps AUTH_INVALID and points to Billing
  • npm run typecheck passes, and npm test passes (366 tests).
  • Also run live against a local Batch API returning both the old and the new response.

🤖 Generated with Claude Code

emirlan-zen and others added 2 commits October 15, 2026 11:27
The Batch API now answers a valid key whose subscription is past due,
unpaid, incomplete or paused with 401 code subscription_inactive. The CLI
treated every 401 as a bad key and told the user to log in again, which
cannot fix a billing state.

Keep the AUTH_INVALID code for every 401 so scripts and agents that
branch on it are unaffected; for subscription_inactive only the message
and next action change, pointing to Billing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant