Repository navigation
Resolve‑ShpError
Asks Copilot to explain and fix the last error in the session.
Resolve-ShpError [[-ErrorRecord] <ErrorRecord>] [[-Model] <String>] [-EnableTools] [[-Instruction] <String>]
[<CommonParameters>]
Takes an error record - by default the most recent one in $Error - and sends it to the model together with the command that produced it, its category, target and script stack trace, then returns the model's diagnosis and suggested fix.
This is the "what just went wrong?" shortcut: instead of copying an exception into a prompt by hand, run Resolve-ShpError straight after a failure. All the browsing and tool switches of Invoke-Shp are off by default here, because diagnosing an error needs no tools; pass -EnableTools to let the model read files or run commands while it investigates.
Get-Item /nope
Resolve-ShpError
Explains the most recent error and suggests a fix.
$Error[2] | Resolve-ShpError -Model claude-opus-5
Explains an older error from the session using a specific model.
Let the model use the file and terminal tools while diagnosing. Off by default, so a plain Resolve-ShpError only reads the error text you already have and cannot touch the machine.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseThe error to explain. Defaults to $Error[0], the most recent error in the session. Accepts pipeline input, so $Error[3] | Resolve-ShpError works.
Type: ErrorRecord
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: FalseExtra guidance appended to the built-in diagnostic system prompt, for example 'answer with a corrected one-liner only'.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe model id to use. Defaults to the session default model, exactly as Invoke-Shp does when the parameter is omitted.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
- Clear-ShpChat
- Clear-ShpContext
- Clear-ShpRedactionPolicy
- Clear-ShpToolPolicy
- Clear-ShpUsage
- Compress-ShpChat
- ConvertTo-ShpAnnotation
- ConvertTo-ShpOtelTrace
- ConvertTo-ShpTokenCount
- Get-ShpChat
- Get-ShpChatCheckpoint
- Get-ShpContext
- Get-ShpContextReport
- Get-ShpCosineSimilarity
- Get-ShpCostEstimate
- Get-ShpDefault
- Get-ShpMcpServer
- Get-ShpModel
- Get-ShpModelName
- Get-ShpRedactionPolicy
- Get-ShpTool
- Get-ShpToolPolicy
- Get-ShpUsage
- Initialize-Shp
- Invoke-Shp
- Invoke-ShpBatch
- Invoke-ShpEval
- Invoke-ShpSubagent
- Register-ShpMcpServer
- Register-ShpTool
- Request-ShpEmbedding
- Resolve-ShpError
- Restore-ShpChat
- Save-ShpChat
- Select-ShpModel
- Set-ShpContext
- Set-ShpRedactionPolicy
- Set-ShpToolPolicy
- Start-ShpChat
- Test-ShpCiReadiness
- Unregister-ShpMcpServer
- Unregister-ShpTool