Skip to content

[Bug]: Claude 4.6+ fails silently (temperature+top_p) + outdated retired model list #566

Description

@anatoliesernii

Bug report

opencommit version: 3.3.2 (npm i -g opencommit@latest)

Environment: macOS, Node v24, OCO_AI_PROVIDER=anthropic

Summary

Using current Anthropic models with opencommit fails in two ways that together look like an infinite hang on "Generating the commit message":

  1. claude-sonnet-4-6 (and other 4.6+ models) still send both temperature and top_p — PR fix(anthropic): remove top_p parameter for Claude 4.5 models #521 only exempts models matching claude.*-4-5, so 4.6+ still hit Anthropic's 400 error.
  2. That 400 is misclassified as ModelNotFoundError because isModelNotFoundMessage() treats any message containing both "model" and "invalid" as a missing model. opencommit then opens the interactive model picker behind the spinner, which looks like a forever hang.

Additionally, the built-in Anthropic model list and fallback picker only offer retired models (as of June 15, 2026), so every suggested alternative also fails.

Related: #520 / PR #521 (fixed 4.5 only)


Steps to reproduce

npm i -g opencommit@latest
oco config set OCO_AI_PROVIDER=anthropic OCO_API_KEY=<key> OCO_MODEL=claude-sonnet-4-6
git add .
oco

Observed: Spinner stays on "Generating the commit message" indefinitely (or shows model picker with only retired models).


Root cause 1: top_p still sent for Claude 4.6+

src/engine/anthropic.ts (master as of 2026-06-22):

// add top_p for non-4.5 models
if (!/claude.*-4-5/.test(params.model)) {
  params.top_p = 0.1;
}

For claude-sonnet-4-6, this adds top_p: 0.1 alongside temperature: 0. Anthropic returns:

{
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "`temperature` and `top_p` cannot both be specified for this model. Please use only one."
  }
}

Root cause 2: 400 misclassified → spinner + hidden model picker

src/utils/engineErrorHandler.ts:

function isModelNotFoundMessage(message: string): boolean {
  const lowerMessage = message.toLowerCase();
  return (
    (lowerMessage.includes('model') &&
      (lowerMessage.includes('not found') ||
        lowerMessage.includes('does not exist') ||
        lowerMessage.includes('invalid') ||  // ← matches the 400 above
        lowerMessage.includes('pull'))) ||
    lowerMessage.includes('does_not_exist')
  );
}

The temperature/top_p error message contains "model" and the JSON type is "invalid_request_error", so it is treated as model-not-found. handleModelNotFoundError() then prompts for an alternative model while the spinner is still running.


Root cause 3: outdated default / fallback model list

src/commands/config.ts still lists retired Anthropic models:

  • claude-sonnet-4-20250514 (retired 2026-06-15)
  • claude-opus-4-20250514 (retired 2026-06-15)
  • claude-3-7-sonnet-20250219 (retired 2026-02-19)
  • claude-3-5-sonnet-20241022 (retired)
  • claude-3-5-haiku-20241022 (retired)

oco models --provider anthropic shows only these. Users upgrading from an old config get stuck in a retry loop with dead models.


Expected behavior

  • claude-sonnet-4-6, claude-opus-4-8, claude-haiku-4-5, etc. should work out of the box.
  • Invalid-parameter 400s should surface as a clear error, not trigger the model picker.
  • Default / suggested Anthropic models should be current (per Anthropic deprecations).

Suggested fixes

1. src/engine/anthropic.ts — stop sending top_p for all recent Claude models (simplest: remove top_p entirely when temperature is set, or broaden the exemption):

// Don't send both temperature and top_p — unsupported on Claude 4.5+
if (!/claude.*-4-(5|[6-9])/.test(params.model)) {
  params.top_p = 0.1;
}

Or just drop top_p for all Anthropic requests since temperature: 0 is already set.

2. src/utils/engineErrorHandler.ts — tighten isModelNotFoundMessage():

  • Remove the broad invalid check, or
  • Only match invalid when status is 404, or
  • Exclude invalid_request_error / temperature / top_p parameter errors

3. src/commands/config.ts — update MODEL_LIST.anthropic and RECOMMENDED_MODELS:

anthropic: [
  'claude-sonnet-4-6',
  'claude-opus-4-8',
  'claude-haiku-4-5-20251001',
  'claude-sonnet-4-5-20250929',
]

Workaround (confirmed)

Until a release ships:

# Option A: use a 4.5 model (exempt from top_p via #521)
oco config set OCO_MODEL=claude-sonnet-4-5-20250929

# Option B: patch global install — broaden regex in out/cli.cjs / src/engine/anthropic.ts

Environment details

  • opencommit: 3.3.2
  • Node: v24.11.1
  • Provider: anthropic
  • Model tested: claude-sonnet-4-6
  • Direct API call with same key + model works; only opencommit's dual-parameter request fails

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions