Skip to content

gh agent-task create fails with 'invalid apiVersion' error #12730

@morj

Description

@morj

Describe the bug

When using gh agent-task create with the --custom-agent flag, the request fails with 400 Bad Request: invalid apiVersion.

Steps to reproduce

gh agent-task create "Test task" --repo my-org/my-repo --custom-agent my-custom-agent --base main

Expected behavior

Agent task should be created successfully.

Actual behavior

bad request: error: invalid apiVersion
failed to create job: 400 Bad Request

Debug output

With GH_DEBUG=api, the request body sent by gh CLI doesn't include an apiVersion field:

{
  "problem_statement": "Test task",
  "custom_agent": "my-custom-agent",
  "event_type": "gh_cli",
  "created_at": "0001-01-01T00:00:00Z",
  "updated_at": "0001-01-01T00:00:00Z",
  "pull_request": {
    "id": 0,
    "number": 0,
    "base_ref": "refs/heads/main"
  }
}

The API endpoint api.githubcopilot.com responds with:

HTTP/2.0 400 Bad Request
bad request: error: invalid apiVersion

Environment

  • gh version: 2.87.0 (2026-02-18)
  • OS: Linux
  • Custom agent location: Organization-level agent in .github-private/agents/

Additional context

  • The same error occurs even without the --custom-agent flag
  • Custom agent YAML frontmatter does not contain an apiVersion field (correctly following the docs)
  • This may be related to recent Copilot API changes or the upcoming network configuration changes mentioned for Feb 27, 2026
  • Recent Copilot API outages on Feb 9-10 affected the same /agents/swe/* endpoint

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority-2Affects more than a few users but doesn't prevent core functions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions