Skip to content

Provider API: HTTP 400 "a single path expansion cannot exceed 512 candidates" makes a long session unrecoverable #959

Description

@Success625

Summary

A long-running session using the Provider API (/provider/v1/chat/completions)
started receiving HTTP 400 on every request and could not be recovered. Other
sessions on the same account worked normally.

Error body:

{"message":"a single path expansion cannot exceed 512 candidates trace_id: 5a604d6ce8d75303493e0438b66a84ba","type":"invalid_request_error"}

trace_ids observed over ~10 minutes (6 consecutive failed requests):
7968d9b9b9e8349578f610eaed588d95, 9d02af819df5685f206856f2bbc3baab,
660a04061c0e7b767f85cdffc8ef45e4, eb0ef9bd3ff006d492bd9cd597951c1e,
e35f596ba07869df219ba44ea244d5e0, 5a604d6ce8d75303493e0438b66a84ba

Environment

  • Client: OpenCode v2.0.18, provider configured directly with
    @ai-sdk/openai-compatible (no Command Code plugin/harness involved)
  • Model: deepseek/deepseek-v4.1-flash
  • Endpoint: POST https://api.commandcode.ai/provider/v1/chat/completions
  • Session size at failure: ~210 messages / ~574k input tokens (normal requests
    had worked for hours in the same session)

Expected Behavior

Session should continue normally or be recoverable using the continue prompt without the same unrecoverable error showing up.

Actual Behavior

  • The first 400 occurred automatically — no /compact, no user prompt, right
    after a tool/background task completed.
  • Every subsequent request for that session failed with the same error.
    Reverting the conversation to earlier messages did not help.
  • Requests from other sessions (same account, same provider) continued to work.

Steps to reproduce the issue

This is my first time encountering this bug and I can't really tell exactly how to reproduce the issue.

Command Code Version

N/A

Operating System

Linux

Terminal/IDE

opencode

Shell

zsh

Session file (optional)

No response

Fix prompt (optional)

No response

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions