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 pipelines → process.type = 2
Classic pipelines → process.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
processproperly before callingupdateDefinition.When you callupdateDefinition(), Azure DevOps expects theprocessproperty of the pipeline definition to be in a typed form (YamlProcessorDesignerProcess).-
getDefinition()returnsprocesscorrectly. - But when you pass the object back directly, the VSS client serializer doesn’t recognize
processand throws:TFS.WebApi.
processis missing or incorrectly typed when sending back. ✅ Fix Keep theprocessproperty intact, or re-wrap it into the right structure before callingupdateDefinition.- YAML pipelines →
process.type = 2 - Classic pipelines →
process.type = 1+ phases
▶ Resume Version If you want to resume instead of pausing, just set:buildClient3_2.
In short:def.- Cause: Azure expects a typed
processobject. - Fix: Preserve or reassign the
processproperly before callingupdateDefinition.
-