When any Function writes $null to the output stream, this causes the following error:
ERROR: Trace-PipelineObject : Cannot bind argument to parameter 'InputObject' because it is null.
The $null value can be hardcoded, returned from a cmdlet or a function, etc. For example, each of the following lines causes this error:
$null
Write-Output $null
Get-Something # This command returns $null
Workaround
Avoid writing $null to output. If you invoke a command that may return $null, capture the value by assigning it to a variable, or pipe it to Out-Null, for example:
$Result = Do-Something
Get-Something | Out-Null