3
Get-PSReadLineKeyHandler : A parameter cannot be found that matches parameter name 'Key'.
At line:380 char:43
+             if ((Get-PSReadLineKeyHandler -Key Spacebar).Function -eq ...
+                                           ~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-PSReadLineKeyHandler], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.GetKeyHandlerCommand

Get-PSReadLineKeyHandler : A parameter cannot be found that matches parameter name 'Key'.
At line:383 char:43
+             if ((Get-PSReadLineKeyHandler -Key Enter).Function -eq 'O ...
+                                           ~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-PSReadLineKeyHandler], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.GetKeyHandlerCommand

This appears everytime whenever I open my powershell. What can I do to fix this?

Looking for a solution.

Bipul Hf
  • 33
  • 1
  • 5

2 Answers2

9

You need to update the PSReadLine module. Run:

Install-Module PsReadLine -Force
jfrmilner
  • 1,458
  • 10
  • 11
5

I had the same exact issue. It occurred for me when trying to change my theme in the oh-my-posh init line in $profile. Running Install-Module PsReadLine -Force fixed the error, but my theme still didn't change. When editing $PROFILE make sure you put in

oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/ENTER-THEME-NAME-HERE.omp.json" | Invoke-Expression

and not

oh-my-posh init pwsh --config "~/ENTER-THEME-NAME-HERE.omp.json" | Invoke-Expression

The page is wrong under the powershell tab under the Config syntax paragraph.

Hope this helps.

ldw300
  • 51
  • 1