Pipelines cannot be run concurrently
See original GitHub issueCustomers are running into System.Management.Automation.PSInvalidOperationException: The pipeline was not run because a pipeline is already running. Pipelines cannot be run concurrently error when calling Add-AzVhd method from Az.Compute module. Looking at the stack trace, it’s coming from the following method in Automation SDK: System.Management.Automation.Runspaces.PipelineBase.DoConcurrentCheck(Boolean syncCall, Object syncObject, Boolean isInLock)
However, we are not able to reproduce it every time. We are only able to reproduce it successfully around 20% of the time. We are not using any piping in our PS script. Could you guys help us out in determining what the problem might be?
Steps to reproduce
No reliable reproduce method. Personally, I am unable to reproduce it, however another engineer is able to and he has around 20% repro rate.
# Cosine IOT Services Azure Internal Consumption
$subscriptionId='f9cb372a-8903-4370-9ce0-3042e3bb2cc8'
$rgSeed = "akstest" # TODO customize
$vmSeed = "0430c101a"
$vhdFolder = "C:\Users\jiria\Downloads"
$vhdFileName = "aks-vhd-2.0.20200815.0745.vhd"
$storageAccountName = "storage" + $rgSeed
$location = "westus2"
# $vmSize = "Standard_A2"
$vmSize = "Standard_NC6"
.\vm-create.ps1 $subscriptionId $rgSeed $vmSeed $vhdFolder $vhdFileName $storageAccountName $location $vmSize
Expected behavior
No error
Actual behavior
error: Exception - System.Management.Automation.PSInvalidOperationException: The pipeline was not run because a pipeline is already running. Pipelines cannot be run concurrently.
Environment data
Issue Analytics
- State:
- Created 3 years ago
- Comments:9
Top Results From Across the Web
Pipeline not executed because a pipeline is already ...
When attempting to run a script, I am getting an error message. Here is my script: ... Pipelines cannot be executed concurrently.
Read more >PowerShell - Pipeline not executed because a ...
PowerShell - Pipeline not executed because a pipeline is already executing. Pipelines cannot be executed concurrently.
Read more >Exchange Management Shell Pipeline Not Executed ...
Pipeline not executed because a pipeline is already executing. Pipelines cannot be executed concurrently. + CategoryInfo : OperationStopped: ( ...
Read more >Powershell Error: Pipelines Cannot be Executed ...
Today I have received the Powershell error “Pipelines Cannot be Executed Concurrently” while running commands in Exchange Management Shell.
Read more >Bitbucket Cloud Pipelines parallel steps do not run ...
The reason why Step-3 did not run concurrently with the other steps is that it has to prepare the step container to set...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

A pipeline here is what runs the commands. The error message means you’re trying to run multiple commands at the same time on the same thread (i.e. in the same runspace).
In the snippet and error message you’ve shown, there isn’t enough information to establish what’s going on. In particular we don’t know what cmdlets are being used, where the error occurs or any other details about the error. We need:
vm-create.ps1and any other scripts being called – we need to know the whole program you’re runningGet-Erroror$error[0] | fl * -forceafter you reproduceI think they mentioned the cmdlet they ran;
Add-AzVhd– I suspect the cmdlet is doing something… unwise… internally if that’s all they ran.