Skip to content

Batch commands fail on Sourcegraph 7.1.0 - GraphQL fields removed from schema #1287

@jeremy-dobler

Description

@jeremy-dobler

Batch commands fail on Sourcegraph 7.1.0 - GraphQL fields removed from schema

Environment

  • Sourcegraph version: 7.1.0 (instance: sourcegraph.dev.bullhorn.com)
  • src-cli version: 7.0.2 (latest release)
  • Platform: macOS (Darwin 25.3.0)

Problem

All src batch commands fail immediately on Sourcegraph 7.1.0 with GraphQL errors. The batch changes feature is completely unusable.

Error Message

❌ Error:
   failed to query Sourcegraph version and license info for instance: GraphQL errors: 2 errors occurred:
        * {
     "locations": [
       {
         "column": 2,
         "line": 5
       }
     ],
     "message": "Cannot query field \"maxUnlicensedChangesets\" on type \"Query\"."
   }
        * {
     "locations": [
       {
         "column": 2,
         "line": 6
       }
     ],
     "message": "Cannot query field \"batchChanges\" on type \"Query\"."
   }

Steps to Reproduce

  1. Upgrade Sourcegraph instance to version 7.1.0
  2. Run any batch command with src-cli 7.0.2:
    src batch preview -f batch-spec.yaml
    src batch apply -f batch-spec.yaml
    src batch repos -f batch-spec.yaml
  3. All commands fail with the same GraphQL error

Root Cause

The GraphQL query in internal/batches/service/service.go still queries fields that were removed from Sourcegraph 7.1.0's GraphQL schema:

const getInstanceInfo = `query InstanceInfo {
  site {
    productVersion
  }
  maxUnlicensedChangesets
  batchChanges(first: 1) {
    nodes {
      id
    }
  }
}`

This query runs before every batch operation via getSourcegraphVersionAndMaxChangesetsCount(). Since these fields no longer exist in the schema, all batch commands fail immediately.

Context

This is similar to PR #1264 which fixed the same issue with the deprecated usageStatistics field. The Sourcegraph 7.1.0 changelog mentions that the GraphQL API is being renamed to the "Debug API" and a new versioned API is being introduced, which likely caused these fields to be removed.

Impact

  • All batch changes operations are blocked on Sourcegraph 7.1.0
  • Affects all users who have upgraded to 7.1.0
  • No workaround available with the current src-cli 7.0.2 release

Suggested Fix

Update the GraphQL query to either:

  1. Remove the deprecated fields and handle the missing data gracefully
  2. Use conditional queries based on Sourcegraph version
  3. Query the new API endpoint if available in 7.1.0

A similar fix pattern was used in #1264 for the usageStatistics field removal.

Related Issues

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions