git stash apply unknown option: -encodedCommand error

What I didn't realise...

I was in powershell (to use posh-git) and of course {} is indicating powershell code.

Therefore surrounding in '' will ensure powershell interprets it as a string.

git stash apply 'stash@{1}'

Notably posh-git autocompletes the name when pressing tab (which made me realise my error).


Putting this here for Google searches:

This will also happen if you are using a Windows runner with GitHub Actions and miss the $ in an expression like ${{ github.ref }}.


What makes this especially confusing in this case, is that the error will be interleaved with the output, making it appear to come from whatever you're invoking. E.g. in my case:

Run iscc.exe InstallCreation\inno\service.iss /DMyAppVersion={{ github.ref }}
  iscc.exe InstallCreation\inno\service.iss /DMyAppVersion={{ github.ref }}
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
Unknown option: -encodedCommand
Inno Setup 6 Command-Line Compiler

⬆️the -encodedCommand has nothing to do with Inno Setup 6.