Skip to content

[Bug]: Azure DevOps issue list fails on every project: az devops invoke --resource workitems resolves the create route (KeyError: 'type') #38015

Closed

Description

@Jirhonet

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Add an Azure DevOps (dev.azure.com) project to T3 Code. az login works and az devops commands succeed.
  2. Open the Issues tab.

Expected behavior

The project's work items are listed.

Actual behavior

Every Azure DevOps project shows Azure DevOps CLI command failed. (13 of 13 projects in our organization).

The first two calls in listIssues succeed: workitemtypes and the WIQL POST both return results. The third call, which loads the matched items, crashes inside the azure-devops CLI extension before any request is sent:

az devops invoke --detect false --organization https://dev.azure.com/<org> --area wit --resource workitems \
  --api-version 7.1 --route-parameters "project=<project>" \
  --query-parameters "ids=1,2,3" "fields=System.Id,System.Title" --only-show-errors --output json
File ".../azext_devops/devops_sdk/client.py", line 116, in _create_request_message
    url = self._client.format_url(route_template, **route_values)
File ".../msrest/service_client.py", line 151, in format_url
KeyError: 'type'

Cause: the wit area has two locations whose resource name is workitems, both with the same max version:

id routeTemplate
62d3d110-0047-428c-ad3c-4fe872c91c74 {project}/_apis/{area}/{resource}/${type} (create)
72c7ddf8-2cdc-4f60-90cd-ab71c14a399b {project}/_apis/{area}/{resource}/{id} (get / list)

az devops invoke resolves a location by resource name and only replaces its pick when a later match has a strictly higher maxVersion (azext_devops/dev/team/invoke.py, around line 86). The server lists the create location first, so the CLI builds the URL from .../workitems/${type} and fails on the missing type route value. Passing a type would not help: it would target the create endpoint.

The call is in packages/source-control-azure-devops/src/server/AzureDevOpsIssueTracker.ts (resource: "workitems", around line 669 on main).

Suggested fix: load the items with workitemsbatch instead. It has a single location, so the lookup is unambiguous. This works on the same organization:

az devops invoke --detect false --organization https://dev.azure.com/<org> --area wit --resource workitemsbatch \
  --api-version 7.1 --route-parameters "project=<project>" --http-method POST \
  --in-file body.json --media-type application/json
# body.json: {"ids":[1,2,3],"fields":["System.Id","System.Title","System.State"],"errorPolicy":"omit"}

invokeWithBody already handles POST bodies, so this could reuse it. errorPolicy: "omit" also keeps one deleted or inaccessible id from failing the whole page.

Separately, the UI only shows "Azure DevOps CLI command failed." Surfacing the CLI's stderr (or logging it in server.trace.ndjson) would have made this much quicker to find.

Impact

Blocks work completely

Version or commit

0.1.11-nightly.20261117.4825 (main still has the same call at the time of writing)

Environment

Windows 11 Pro, T3 Code desktop nightly, azure-cli 2.83.0 (MSI install), azure-devops extension 1.0.6, dev.azure.com organization

Logs or stack traces

AzureDevOpsCommandFailedError: Azure DevOps CLI failed in execute: Azure DevOps CLI command failed.
    at AzureDevOpsCommandFailedError.fromVcsError (.../ManagedEndpointRuntime-*.mjs)
    ...
    at AzureDevOpsCli.execute (...)
    at IssueService.list (...)
    at ws.rpc.issues.list (...)

Workaround

None found. Changing the extension version or login does not help, because the location order comes from the server.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions