Skip to content

analyze-prompt fails with "does not support thinking" when alwaysThinkingEnabled is true #6

@cosminfuica

Description

@cosminfuica

Bug: analyze-prompt fails with "does not support thinking" error when using Haiku model

Environment

  • vibe-log-cli: v0.7.2
  • Claude Code SDK: @anthropic-ai/claude-code v1.0.128
  • Claude Code settings: alwaysThinkingEnabled: true

Issue

The analyze-prompt command fails when called from the UserPromptSubmit hook with exit code 1:

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"'claude-3-5-haiku-20241022' does not support thinking."}}

Root Cause

The SDK query uses haiku as the default model, but when Claude Code has alwaysThinkingEnabled: true in settings, the SDK enables thinking mode globally. Haiku doesn't support thinking, causing the API request to fail.

Reproduction

  1. Set alwaysThinkingEnabled: true in ~/.claude/settings.json
  2. Configure UserPromptSubmit hook: npx vibe-log-cli analyze-prompt --stdin --silent
  3. Submit any prompt in Claude Code
  4. Hook fails with "does not support thinking" error

Proposed Fix

In src/lib/prompt-analyzer.ts, either:

Option 1: Use Sonnet instead of Haiku for analysis

const selectedModel = options.model || 'sonnet'; // Supports thinking

Option 2: Explicitly disable thinking in queryOptions

const queryOptions = {
  maxTurns: 1,
  model: selectedModel,
  disallowedTools: ["*"],
  maxThinkingTokens: 0, // Disable thinking for Haiku compatibility
  cwd: tempAnalysisDir
};

Option 3: Check Claude Code settings and choose model accordingly

const claudeSettings = readClaudeSettings();
const selectedModel = claudeSettings.alwaysThinkingEnabled 
  ? 'sonnet'  // Use Sonnet if thinking is enabled
  : 'haiku';  // Use Haiku otherwise

Workaround

Users can manually patch the installed package or set alwaysThinkingEnabled: false in their Claude Code settings (though this affects the entire Claude Code experience).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions