Azure Pipelines "Unable to process command '##vso[...]'"
The agent parses ##vso[...] logging commands from stdout. When the syntax is wrong (bad properties, an unescaped value, or a stray space) the agent cannot process it and the intended side effect, like setting a variable, silently does not happen.
What this error means
The log shows ##[error]Unable to process command '##vso[task.setvariable ...]' successfully or a downstream step sees an unset variable that an earlier echo was supposed to set.
##[error]Unable to process command '##vso[task.setvariable variable=]value' successfully.
##[error]Failed to process logging command: the 'variable' property is required.Common causes
A malformed logging command
A required property like variable= is missing or empty, or the closing bracket and value are placed wrong, so the agent cannot parse the command.
An unescaped value in the command
Special characters (;, %, newlines) in the value need escaping; unescaped, they break the command structure.
How to fix it
Emit the logging command with correct syntax
Echo the full ##vso command with all required properties on one line. The value goes after the closing bracket.
steps:
- bash: |
echo "##vso[task.setvariable variable=buildTag]v1.2.3"
displayName: 'Set build tag'Escape special characters in the value
- Replace
;with%3Band%with%25inside the value. - Keep the entire command on a single echoed line.
- Confirm a later step reads the variable as
$(buildTag).
How to prevent it
- Echo
##vsocommands on one line with every required property. - Escape
;and%in values that contain them. - Verify the variable is read with the correct macro syntax downstream.