Share via

Getting "TFS.WebApi.Exception: Expecting 'Process' to be of type 'T'." exception when updating pipeline

Rihanna Zekri 20 Reputation points
2025-09-27T07:19:40.3766667+00:00

Hi all,

I'm facing an issue using Azure VSS library and I'd appreciate any help on this.

I'm trying to write an extension for Azure Pipelines that updates the pipeline status via api call. And by API call, I mean VSS service (vanilla JavaScript).

When user clicks on a button, I load the pipeline definition first, change the status and call updateDefinition method. However, I get an exception saying it expects the Process type to be T.

I'm using BuildHttpClient3_2 from TFS/Build/RestClient.

Here is the code:

buildClient3_2.getDefinition(definitions[i].id, projectId, definitions[i].revision).then((def) => {
                    console.log("Fetched definition:", def);
                    let d1 = def;
                    d1.queueStatus = 1; // Paused

                    buildClient3_2.updateDefinition(d1, def.id, projectId).then((d) => {
                        console.log("Pipeline paused:", d);
                    }).catch((error) => {
                        console.error("Error updating definition:", error);
                    });
                });

and here is the response:

pipelines.js:253 Error updating definition: TFS.WebApi.Exception: Expecting 'Process' to be of type 'T'.
    at d (vss-bundle-ext-core-…7AZ8tFb0Sc=:314:735)
    at vss-bundle-ext-core-…AZ8tFb0Sc=:314:2918
    at g (vss-bundle-ext-core-…7AZ8tFb0Sc=:314:998)
    at vss-bundle-ext-core-…AZ8tFb0Sc=:314:2851
    at l (vss-bundle-ext-core-…AZ8tFb0Sc=:282:8126)
    at vss-bundle-ext-core-…AZ8tFb0Sc=:282:8352
    at t.when (vss-bundle-ext-core-…AZ8tFb0Sc=:282:3784)
    at u.promiseDispatch (vss-bundle-ext-core-…AZ8tFb0Sc=:282:2828)
    at vss-bundle-ext-core-…AZ8tFb0Sc=:282:1653
    at MessagePort.t (vss-bundle-ext-core-…AZ8tFb0Sc=:282:5777)

What am I doing wrong?

Thanks in advance.

Azure DevOps
0 comments No comments

Answer accepted by question author

Sheeraz Ali 170 Reputation points
2025-09-27T08:17:36.48+00:00

When you call updateDefinition(), Azure DevOps expects the process property of the pipeline definition to be in a typed form (YamlProcess or DesignerProcess).

getDefinition() returns process correctly.

But when you pass the object back directly, the VSS client serializer doesn’t recognize process and throws:

TFS.WebApi.Exception: Expecting 'Process' to be of type 'T'.

So the root cause → process is missing or incorrectly typed when sending back.


Fix

Keep the process property intact, or re-wrap it into the right structure before calling updateDefinition.

YAML pipelinesprocess.type = 2

Classic pipelinesprocess.type = 1 + phases


📝 Full Working Snippet (Pause Example)

buildClient3_2.getDefinition(definitions[i].id, projectId, definitions[i].revision)
  .then(def => {
      console.log("Fetched definition:", def);

      // Pause pipeline
      def.queueStatus = 1; // 0 = enabled, 1 = paused

      // Ensure process is correctly typed
      if (def.process) {
          if (def.process.type === 2) {
              // YAML pipeline
              def.process = { type: 2 };
          } else if (def.process.type === 1) {
              // Classic pipeline
              def.process = { type: 1, phases: def.process.phases };
          }
      }

      return buildClient3_2.updateDefinition(def, def.id, projectId);
  })
  .then(updated => {
      console.log("Pipeline paused:", updated);
  })
  .catch(err => {
      console.error("Error updating definition:", err);
  });

Resume Version

If you want to resume instead of pausing, just set:

def.queueStatus = 0; // enabled

In short:

Cause: Azure expects a typed process object.

  • Fix: Preserve or reassign the process properly before calling updateDefinition.When you call updateDefinition(), Azure DevOps expects the process property of the pipeline definition to be in a typed form (YamlProcess or DesignerProcess).
    • getDefinition() returns process correctly.
    • But when you pass the object back directly, the VSS client serializer doesn’t recognize process and throws:
          TFS.WebApi.
      
    So the root cause → process is missing or incorrectly typed when sending back. ✅ Fix Keep the process property intact, or re-wrap it into the right structure before calling updateDefinition.
    • YAML pipelinesprocess.type = 2
    • Classic pipelinesprocess.type = 1 + phases
    📝 Full Working Snippet (Pause Example)
      buildClient3_2.
    
    ▶ Resume Version If you want to resume instead of pausing, just set:
      def.
    
    In short:
    • Cause: Azure expects a typed process object.
    • Fix: Preserve or reassign the process properly before calling updateDefinition.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.