{"record":{"id":"7b3a4f668695dc3c","repo":"headroomlabs-ai/headroom","slug":"error-model-auto-is-not-supported-in-copilot","errorCode":null,"errorMessage":"Error: '--model auto' is not supported in Copilot BYOK mode. BYOK routes to an external provider (Anthropic/OpenAI) which does not recognise 'auto' as a model name — the request will fail with a 400 error. Options: • Use a concrete model: --model gpt-4o • Use subscription mode for native auto-routing: headroom wrap copilot --subscription -- --model auto","messagePattern":"Error: '--model auto' is not supported in Copilot BYOK mode\\. BYOK routes to an external provider \\(Anthropic/OpenAI\\) which does not recognise 'auto' as a model name — the request will fail with a 400 error\\. Options: • Use a concrete model: --model gpt-4o • Use subscription mode for native auto-routing: headroom wrap copilot --subscription -- --model auto","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"headroom/cli/wrap.py","lineNumber":5459,"sourceCode":"            )\n            raise SystemExit(1)\n\n    if not subscription and not _copilot_model_configured(copilot_args, env):\n        # Distinguish between \"--model auto\" (wrong model for BYOK) and\n        # genuinely missing model (no --model flag at all).\n        raw_model = _copilot_model_from_args(copilot_args, env)\n        if _is_auto_model(raw_model):\n            click.echo(\n                \"  Error: '--model auto' is not supported in Copilot BYOK mode.\\n\"\n                \"  BYOK routes to an external provider (Anthropic/OpenAI) which\\n\"\n                \"  does not recognise 'auto' as a model name — the request will\\n\"\n                \"  fail with a 400 error.\\n\"\n                \"  Options:\\n\"\n                \"    • Use a concrete model: --model gpt-4o\\n\"\n                \"    • Use subscription mode for native auto-routing:\\n\"\n                \"      headroom wrap copilot --subscription -- --model auto\"\n            )\n            raise SystemExit(1)\n        else:\n            click.echo(\n                \"  Note: Copilot BYOK requires a model. Pass `--model <name>` \"\n                \"or set `COPILOT_MODEL` / `COPILOT_PROVIDER_MODEL_ID`.\"\n            )\n\n    _launch_tool(\n        binary=copilot_bin,\n        args=copilot_args,\n        env=env,\n        port=port,\n        no_proxy=no_proxy,\n        tool_label=\"COPILOT\",\n        env_vars_display=env_vars_display,\n        learn=False,\n        memory=memory,\n        agent_type=\"copilot\",\n        backend=backend,","sourceCodeStart":5441,"sourceCodeEnd":5477,"githubUrl":"https://github.com/headroomlabs-ai/headroom/blob/322425c43bffde1ed0b64fecf3cf5951565dd82b/headroom/cli/wrap.py#L5441-L5477","documentation":"In Copilot BYOK mode with no --model configured and no subscription, Headroom inspects the effective model (from args or COPILOT_MODEL / COPILOT_PROVIDER_MODEL_ID). 'auto' is a Copilot-subscription concept for native routing; BYOK forwards the model name verbatim to Anthropic/OpenAI, which reject 'auto' with a 400. Headroom fails fast with this message instead of letting the request die upstream, and suggests a concrete model or --subscription for auto-routing.","triggerScenarios":"Running `headroom wrap copilot -- --model auto` (or with COPILOT_MODEL=auto / COPILOT_PROVIDER_MODEL_ID=auto) in BYOK mode (no --subscription), where _is_auto_model() matches the resolved name case-insensitively or via alias. Note the contrasting branch: with no model at all you only get a 'Note:', but 'auto' is a hard SystemExit(1).","commonSituations":"Copy-pasting subscription-mode commands into BYOK mode; COPILOT_MODEL=auto set in a shell profile from prior Copilot usage; switching from `--subscription` to BYOK without changing the model config.","solutions":["Pass a concrete model name the provider recognises: headroom wrap copilot -- --model gpt-4o (or claude-sonnet-4, etc.)","Or keep auto-routing by using subscription mode: headroom wrap copilot --subscription -- --model auto","Unset stale env: unset COPILOT_MODEL COPILOT_PROVIDER_MODEL_ID, or set them to a concrete provider model id","Check the provider's model catalog for valid names before choosing"],"exampleFix":"# before\nheadroom wrap copilot -- --model auto     # BYOK: 'auto' rejected\n\n# after\nheadroom wrap copilot -- --model gpt-4o\n# or, for auto-routing:\nheadroom wrap copilot --subscription -- --model auto","handlingStrategy":"validation","validationCode":"import os\n\ndef model_byok_safe(args: list[str]) -> bool:\n    raw = next((a for a in args if a.startswith(\"--model\")), \"\")\n    name = raw.split(\"=\", 1)[-1] if \"=\" in raw else None\n    env_name = os.environ.get(\"COPILOT_MODEL\") or os.environ.get(\"COPILOT_PROVIDER_MODEL_ID\")\n    effective = name or env_name or \"\"\n    return effective.strip().lower() not in (\"\", \"auto\", \"model-auto\") or not effective","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never pass --model auto in BYOK mode; pick a concrete provider model id","Unset COPILOT_MODEL/COPILOT_PROVIDER_MODEL_ID leftovers from subscription use","Use --subscription when you want Copilot's native auto-routing"],"tags":["byok","model-selection","github-copilot","validation","headroom","cli"],"backgroundTag":null,"analyzedSha":"322425c43bffde1ed0b64fecf3cf5951565dd82b","analyzedAt":"2026-08-15T01:03:05.481Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}