Skip to content

Show-Karma fails after repo-based installation #462

Closed

Description

@johnheusinger

Describe "Module Bug or Issue"

Identical to the issue reported in #452

Context "The Problem"

After following the repo-based installation steps and running Show-Karma, I receive the following error:

PS C:\code\PSKoans> Show-Karma
Show-Karma : The 'Show-Karma' command was found in the module 'PSKoans', but the module could not be loaded. For more
information, run 'Import-Module PSKoans'.
At line:1 char:1
+ Show-Karma
+ ~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Show-Karma:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

Running Import-Module PSKoans as suggested in the first error message:

PS C:\code\PSKoans> Import-Module PSKoans
Import-Module : The member 'FormatsToProcess' in the module manifest is not valid: Cannot find path
'C:\code\PSKoans\PSKoans\PSKoans.format.ps1xml' because it does not exist.. Verify that a valid value is specified for
this field in the 'C:\code\PSKoans\PSKoans\PSKoans.psd1' file.
At line:1 char:1
+ Import-Module PSKoans
+ ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (C:\code\PSKoans\PSKoans\PSKoans.psd1:String) [Import-Module], Argu
   mentException
    + FullyQualifiedErrorId : Modules_InvalidManifest,Microsoft.PowerShell.Commands.ImportModuleCommand

Installing EZOut using -AllowClobber and running PSKoans.ezformat.ps1 as suggested in #452:

PS C:\code\PSKoans> Install-Module EZOut -AllowClobber
PS C:\code\PSKoans> .\PSKoans.ezformat.ps1
PS C:\code\PSKoans>

Running Show-Karma again:

PS C:\code\PSKoans> Show-Karma
Show-Karma : You cannot call a method on a null-valued expression.
At line:1 char:1
+ Show-Karma
+ ~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Show-Karma], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull,Show-Karma

Checking $Error[0].Exception.GetBaseException() | Format-List -Force as suggested in #452:

PS C:\code\PSKoans> $Error[0].Exception.GetBaseException() | Format-List -Force

ErrorRecord                 : You cannot call a method on a null-valued expression.
WasThrownFromThrowStatement : False
Message                     : You cannot call a method on a null-valued expression.
Data                        : {System.Management.Automation.Interpreter.InterpretedFrameInfo}
InnerException              :
TargetSite                  : Void CheckActionPreference(System.Management.Automation.Language.FunctionContext,
                              System.Exception)
StackTrace                  :    at
                              System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext
                              funcContext, Exception exception)
                                 at
                              System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame
                              frame)
                                 at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(Interp
                              retedFrame frame)
                                 at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(Interp
                              retedFrame frame)
                                 at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
                                 at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
                                 at System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object
                              dollarUnderbar, Object inputToProcess)
                                 at System.Management.Automation.PSScriptCmdlet.DoEndProcessing()
                                 at System.Management.Automation.CommandProcessorBase.Complete()
HelpLink                    :
Source                      : System.Management.Automation
HResult                     : -2146233087

Context "Additional Information"

Name    Version
----    -------
PSKoans 0.67.0
PSKoans 0.67.0
Name                           Value
----                           -----
PSVersion                      5.1.22000.65
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22000.65
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Also attempted using PS 7.1.4 on both Windows and macOS with similar results.

No issues when installing from gallery.

Activity

  1. added
    Category-Module
    Issue-Discussion
    on Oct 9, 2021
  2. johnheusinger commented on Oct 16, 2021

    @johnheusinger
    ContributorAuthor

    I also found it odd that the version is showing 0.67.0 although the latest release is 0.67.1.

    Looking at the 0.67.1 release, I see that the file PSKoans.psd1 incorrectly contains the line:

    ModuleVersion         = '0.67.0'
    

    And yet the output of Get-Module -Name PSKoans correctly shows Version 0.67.1 when installed from the gallery.

  3. billyhigdon commented on Dec 21, 2023

    @billyhigdon

    Howdy @johnheusinger - I know this is over two years later - but I ran into the same issue. Took me a little bit to figure out the EZOut module stuff (wish I had just looked into the issues sooner). For me I had the same experience when using Show-Karma and upon checking my modules, I could see it was using Pester 5.5.0 - for some reason everytime i imported PSKoans it would import the latest available version of the module - even though 5.0.2 was installed.

    I tried going through the code to see where it actually imports the module - i'm assuming somewhere it doesn't explicitly state to use 5.0.2 and that's why the latest version is imported. Eventually I just uninstalled 5.5.0 and next time I imported the PSKoans module, it imported 5.0.2 and the Show-Karma cmdlet started working as normal.

  4. ajn142 commented on Apr 28, 2026

    @ajn142
    Contributor

    Only another 3 years later, but I found the cause for that. Per https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_module_manifests?view=powershell-7.6#requiredmodules ModuleVersion is a minimum version, not a specific version, and so PSKoans will always import the latest installed Pester. I also tested, and this error began with Pester 5.2.0. I'll get a patch up later tonight that also sets MaximumVersion to 5.1.1, which should avoid this.

  5. github-actions commented on Sep 20, 2026

    @github-actions

    This issue has had no activity for 60 days. It will be closed in 30 days unless there is new activity or a maintainer removes the stale label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Category-ModuleIssue-Discussionstatus: stale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions