Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 'scoop update' fails with 'TerminatingError(ForEach-Object)' caused by -Parallel when running pwsh 7 (from task scheduler?) #6126

Open
arberg opened this issue Sep 1, 2024 · 1 comment
Labels

Comments

@arberg
Copy link

arberg commented Sep 1, 2024

Current Behavior

When I run my daily task scheduled 'scoop update' it sometimes throws exception and outputs:

Updating Buckets...
PS>TerminatingError(ForEach-Object): "The following common parameters are not currently supported in the Parallel parameter set:
ErrorAction, WarningAction, InformationAction, PipelineVariable"

It believe it fails to update the buckets. It certainly throws an exception. I'm fairly certain it must have failed to update the buckets, since the problem goes away when running manually afterwards.

When scoop enters this erroneous state, every single nightly 'scoop update' task of mine fails, until I run it manually in a pwsh 7 console and after that it just works (for some time, maybe months). Sometimes I have seen it fail when running manually and then work when I start a new pwsh console, or maybe even just drop into a new pwsh subshell within same console window.

I have been unable to reliable reproduce it, but it has been going on for years, though previously I think with a different error-message about -Parallel not supported. Probably the difference in output is a pwsh update.

I've tried reproducing it by reverting all my buckets to previous commits, so scoop update has something to work on, but it doesn't fail by that. So I would expect it is some warning that is sometimes produced by the update script for some buckets that cause it to fail.

Additional context/output

Updating Scoop...


Updating Buckets...
PS>TerminatingError(ForEach-Object): "The following common parameters are not currently supported in the Parallel parameter set:
ErrorAction, WarningAction, InformationAction, PipelineVariable"
>> TerminatingError(ForEach-Object): "The following common parameters are not currently supported in the Parallel parameter set:
ErrorAction, WarningAction, InformationAction, PipelineVariable"
>> TerminatingError(ForEach-Object): "The following common parameters are not currently supported in the Parallel parameter set:
ErrorAction, WarningAction, InformationAction, PipelineVariable"
>> TerminatingError(ForEach-Object): "The following common parameters are not currently supported in the Parallel parameter set:
ErrorAction, WarningAction, InformationAction, PipelineVariable"
>> TerminatingError(ForEach-Object): "The following common parameters are not currently supported in the Parallel parameter set:
ErrorAction, WarningAction, InformationAction, PipelineVariable"
>> TerminatingError(ForEach-Object): "The following common parameters are not currently supported in the Parallel parameter set:
ErrorAction, WarningAction, InformationAction, PipelineVariable"
>> TerminatingError(ForEach-Object): "The following common parameters are not currently supported in the Parallel parameter set:
ErrorAction, WarningAction, InformationAction, PipelineVariable"
Failed Upgrade-Scoop

when running

try {
    scoop update
} catch {
    Write-Host "Failed Upgrade-Scoop"
}

Possible Solution

See changeset #6127

Workaround for the user by wrapping scoop

A work-around for me personally may be the following, which should work as scoop-update.ps1 does not use -Parallel unless it detects pwsh 7:

try {
    Write-Host "Running: scoop update"
    scoop update
    Write-Host "Finished: scoop update"
} catch {
    $_ | Out-Host
    Write-Host "Failed scoop update, retry in powershell 5 to avoid -Parallel problem when executing from Task Scheduler"
    powershell -C {
        try {
            Write-Host "Powershell 5 Running: scoop update"
            scoop update
            Write-Host "Powershell 5 Finished: scoop update"
        } catch {
            Write-Host "failed scoop update in powershell 5:"
            $_ | Out-Host
        }
    }
}

Above would also be a solution if done within the scoop-update.ps1 script just like you do for powershell 5. I have create a change-set which does this.

### System details

**Windows version:** 11

**OS architecture:** 64bit

**PowerShell version:** 7.4.5

#### Scoop Configuration
```json
{
  "last_update": "2024-09-01T11:31:45.3537877+02:00",
  "scoop_repo": "https://github.com/ScoopInstaller/Scoop",
  "scoop_branch": "master"
}
@arberg
Copy link
Author

arberg commented Sep 1, 2024

See #6127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant