Skip to content

Bug: Cannot read properties of null (reading 'length') when using BYOK #3911

Open

Description

@doggy8088

Describe the bug

When using BYOK (Bring Your Own Key) in the Copilot CLI, I encounter the following error: Cannot read properties of null (reading 'length').

Image

Affected version

GitHub Copilot CLI 1.0.64.

Steps to reproduce the behavior

  1. Open Copilot CLI with the following command:

    COPILOT_PROVIDER_TYPE=openai COPILOT_PROVIDER_WIRE_API=completions COPILOT_PROVIDER_BASE_URL=https://api.mistral.ai/v1 COPILOT_PROVIDER_API_KEY=$MISTRAL_API_KEY COPILOT_MODEL=mistral-medium-latest COPILOT_PROVIDER_MAX_PROMPT_TOKENS=262144 COPILOT_PROVIDER_MAX_OUTPUT_TOKENS=262144 copilot --yolo --log-level all --log-dir logs/

  2. Send prompt

    hi
    

Expected behavior

No error

Additional context

process-1782304659429-43157.log

Activity

  1. added theissue type on Jun 24, 2026
  2. added
    area:modelsModel selection, availability, switching, rate limits, and model-specific behavior
    area:configurationConfig files, instruction files, settings, and environment variables
    on Jun 24, 2026
  3. martimmatias commented on Jun 30, 2026

    @martimmatias

    I was having the same issue with the Python Copilot SDK. I believe this error occurs when the OpeanAI compatible API returns a null value for tool_calls.

    According to the OpenAI API docs, this field is an optional array. Copilot should check if it is null before checking the array's length.

    Seeing this error on github-copilot-sdk 1.0.4 with copilot-cli 1.0.65 and 1.0.66.

  4. patniko commented on Oct 26, 2026

    @patniko
    Collaborator

    Thanks for the report. We've shipped fixes in this area since this was filed (most recently in Copilot CLI v1.0.81), and we believe this may now be resolved. Could you retest on the latest release (Copilot CLI v1.0.103) and let us know whether you still see it? If we don't hear back in a couple of weeks, we may close this issue — you can always reopen it.

    Triaged as part of a Copilot SDK backlog review, with help from GitHub Copilot.

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

    area:configurationConfig files, instruction files, settings, and environment variablesarea:modelsModel selection, availability, switching, rate limits, and model-specific behaviormore-info-needed

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions