Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: 400 Error When Using Reasoning Model ("o1-mini") #442

Open
robellegate opened this issue Jan 12, 2025 · 0 comments
Open

[Bug]: 400 Error When Using Reasoning Model ("o1-mini") #442

robellegate opened this issue Jan 12, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@robellegate
Copy link

Opencommit Version

3.2.5

Node Version

22.13.0

NPM Version

10.9.2

What OS are you seeing the problem on?

Other Linux Distro

What happened?

OpenAI’s family of reasoning models (e.g. o1, o1-mini) do not accept system messages.
When I configured OpenCommit with OCO_MODEL=o1-mini and tried to generate a commit,
the process failed with an HTTP 400 error indicating 'messages[0].role' does not support 'system' for this model.

Expected Behavior

I expected OpenCommit to successfully generate a commit message for these new reasoning models without error.

Current Behavior

The process immediately stops with a HTTP 400 “unsupported_value” error if the first message is system. It never proceeds to generate the commit message.

Possible Solution

A solution might be to detect these models (“reasoning” family) in OpenAiEngine.generateCommitMessage()
and remove or merge any system message content into the user prompt.
This ensures the request is valid for those models.

Feature request #441 has been opened for this and includes more detail on possible solution implementations.

Steps to Reproduce

  1. oco config set OCO_MODEL=o1-mini
  2. Optionally set OCO_TOKENS_MAX_INPUT=128000 and OCO_TOKENS_MAX_OUTPUT=65536
  3. Stage a few file changes and run oco
  4. Observe the 400 error about 'system' role not supported

Relevant log output

$ oco
┌  open-commit
│
◇  9 staged files:
  .cspell.json
  .editorconfig
  .github/dependabot.yml
  .github/workflows/ci.yml
  .github/workflows/spellcheck.yml
  .gitignore
  .markdownlint.yaml
  .vscode/extensions.json
  lychee.toml
│
◇  ✖ Failed to generate the commit message
BadRequestError3: 400 Unsupported value: 'messages[0].role' does not support 'system' with this model.
    at APIError3.generate (path/to/lib/node_modules/opencommit/out/cli.cjs:60664:14)
    at OpenAI.makeStatusError (path/to/lib/node_modules/opencommit/out/cli.cjs:60213:22)
    at OpenAI.makeRequest (path/to/lib/node_modules/opencommit/out/cli.cjs:60256:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async OpenAiEngine.generateCommitMessage (path/to/lib/node_modules/opencommit/out/cli.cjs:63730:28)
    at async generateCommitMessageByDiff (path/to/lib/node_modules/opencommit/out/cli.cjs:64405:27)
    at async generateCommitMessageFromGitDiff (path/to/lib/node_modules/opencommit/out/cli.cjs:64617:25)
    at async trytm (path/to/lib/node_modules/opencommit/out/cli.cjs:64584:18)
    at async commit (path/to/lib/node_modules/opencommit/out/cli.cjs:64786:35) {
  status: 400,
  headers: {
    'access-control-expose-headers': 'X-Request-ID',
    'alt-svc': 'h3=":443"; ma=86400',
    'cf-cache-status': 'DYNAMIC',
    'cf-ray': 'REDACTED',
    connection: 'keep-alive',
    'content-length': '221',
    'content-type': 'application/json',
    date: 'Sun, 12 Jan 2025 00:31:44 GMT',
    'openai-organization': 'user-REDACTED',
    'openai-processing-ms': '13',
    'openai-version': '2020-10-01',
    server: 'cloudflare',
    'set-cookie': '__cf_bm=REDACTED; path=/; expires=Sun, 12-Jan-25 01:01:44 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None, _cfuvid=REDACTED; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None',
    'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
    'x-content-type-options': 'nosniff',
    'x-ratelimit-limit-requests': '500',
    'x-ratelimit-limit-tokens': '200000',
    'x-ratelimit-remaining-requests': '499',
    'x-ratelimit-remaining-tokens': '195903',
    'x-ratelimit-reset-requests': '120ms',
    'x-ratelimit-reset-tokens': '1.228s',
    'x-request-id': 'REDACTED'
  },
  request_id: 'REDACTED',
  error: {
    message: "Unsupported value: 'messages[0].role' does not support 'system' with this model.",
    type: 'invalid_request_error',
    param: 'messages[0].role',
    code: 'unsupported_value'
  },
  code: 'unsupported_value',
  param: 'messages[0].role',
  type: 'invalid_request_error'
}
│
└  ✖ 400 Unsupported value: 'messages[0].role' does not support 'system' with this model.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant