Skip to content

[bug] Copilot unusable by default: DEFAULT_MODEL claude-sonnet-4-6 rejected with HTTP 400 #640

Closed

Description

@almai

Summary

jcode-provider-copilot defines its default model using Anthropic's native id format (hyphens), but the Copilot API only accepts its own catalog ids (dots). Every session that falls back to the default fails immediately with HTTP 400.

// crates/jcode-provider-copilot/src/lib.rs:11
pub const DEFAULT_MODEL: &str = "claude-sonnet-4-6";   // Anthropic format — rejected by Copilot

// crates/jcode-provider-copilot/src/lib.rs:13-14
pub const FALLBACK_MODELS: &[&str] = &[
    "claude-sonnet-4.6",                                // Copilot format — correct

The constant three lines above the fallback list contradicts the list itself.

Reproduce

jcode --provider copilot
> hi
Copilot API error (HTTP 400 Bad Request): {"error":{"message":"The requested model is not
supported.","code":"model_not_supported","param":"model","type":"invalid_request_error"}}

Isolated against the API directly, same token and headers for both:

model result
claude-sonnet-4.6 200 OK
claude-sonnet-4-6 400 model_not_supported

Confirmed on the wire in ~/.jcode/logs/:

[INFO] Copilot request: X-Initiator=user model=claude-sonnet-4-6
[ERROR] ... phase=stream_error provider=Copilot ... "The requested model is not supported."

Meanwhile tier detection reads the catalog correctly, so the right id is already in hand:

Copilot tier detection: 54 total, 26 picker-enabled, default -> claude-sonnet-4.6

Impact

Copilot is unusable out of the box for any session using the default model. Passing -m claude-sonnet-4.6 works, as does pinning default_model in config — so this is purely the constant. claude-opus-4.8, gemini-3.6-flash, and kimi-k2.7-code all work once a valid id is supplied.

Suggested fix

Set DEFAULT_MODEL to "claude-sonnet-4.6". Better still, prefer the default from the /models tier-detection response, which already reports claude-sonnet-4.6, and fall back to the constant only if that fetch fails.

Environment

jcode v0.61.1 (438789e), macOS, Copilot plus_monthly_subscriber_quota

Activity

  1. changed the title [-]Copilot DEFAULT_MODEL is an Anthropic-native id (claude-sonnet-4-6) that the Copilot API rejects with 400[/-] [+][bug] Copilot unusable by default: DEFAULT_MODEL `claude-sonnet-4-6` rejected with HTTP 400[/+] on Jul 28, 2026
  2. almai commented on Jul 28, 2026

    @almai
    Author

    Related: #641 — a separate Copilot auth bug that produces a byte-identical model_not_supported error from an unrelated cause. Worth triaging together, since fixing either one alone leaves the symptom unchanged.

  3. almai commented on Jul 28, 2026

    @almai
    Author

    Workaround

    Pinning the model id explicitly avoids the bad constant, since DEFAULT_MODEL is only consulted when nothing else supplies a model.

    Per-invocation:

    jcode --provider copilot -m claude-sonnet-4.6

    Or persistently, in ~/.jcode/config.toml:

    [provider]
    default_provider = "copilot"
    default_model = "claude-sonnet-4.6"

    Verified working with this in place: claude-sonnet-4.6, claude-opus-4.8, gemini-3.6-flash, kimi-k2.7-code.

    Note that the value must use Copilot's catalog id (dots), not the Anthropic-native form (hyphens). The ids reported by Copilot tier detection in ~/.jcode/logs/ are the correct ones to copy.

  4. added
    bug
    priority: critical
    triage: reproducible
    autonomous: clear
    on Jul 28, 2026
  5. 1jehuang commented on Jul 28, 2026

    @1jehuang
    Owner

    Confirmed and fixed in #643. Your diagnosis was exactly right: DEFAULT_MODEL was the Anthropic-native id (claude-sonnet-4-6), which Copilot's API rejects since it only accepts its own dot-separated catalog ids. It is now claude-sonnet-4.6, matching the head of FALLBACK_MODELS.

    Thanks for isolating it against the API directly and for posting the workaround, that saved a lot of guesswork. Also noting your point about preferring the default from the /models tier-detection response: that is the better long-term shape and worth a follow-up, but the constant fix unblocks the out-of-box case now.

    Labeled priority: critical since it made Copilot unusable by default.


    — Jcode agent (automated triage), on behalf of @1jehuang

  6. added a commit that references this issue on Jul 28, 2026
    8a16d6f
  7. added 2 commits that reference this issue on Aug 30, 2026
    4af72d9
    24fcdf2
  8. added a commit that references this issue on Sep 18, 2026
    1c28399
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

    autonomous: clearbugpriority: criticaltriage: reproducible

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions