Issue
Multiple files contain empty catch blocks that silently swallow exceptions. This violates PowerShell error handling best practices and can make debugging extremely difficult.
Affected Files
Eigenverft.Manifested.Agent.InvokeCodexTask.ps1
Lines 633-635:
catch {
# Ignore non-JSON lines.
}
Eigenverft.Manifested.Agent.InvokeGeminiTask.ps1
Lines 653-655:
catch {
# Ignore invalid JSON payloads.
}
Eigenverft.Manifested.Agent.ps1
Lines 11-13:
catch {
# Best effort only. Older hosts may already be configured appropriately.
}
Problems
- Silent failures - Errors are completely hidden from users and developers
- Debugging difficulty - No way to know when JSON parsing fails
- Best practice violation - PSScriptAnalyzer rule
PSAvoidUsingEmptyCatchBlock
- Troubleshooting - Makes it hard to diagnose issues in production
Recommended Fix
Even if errors are expected and should be ignored, they should be logged:
# Option 1: Log to verbose stream
catch {
Write-Verbose -Message "Failed to parse JSON: $_"
}
# Option 2: Use Write-Debug
catch {
Write-Debug -Message "JSON parse skipped: $_"
}
# Option 3: Continue with explicit comment
catch {
# Ignore non-JSON lines - this is expected behavior
Write-Verbose -Message "Non-JSON line encountered: $($_.Exception.Message)"
}
PSScriptAnalyzer Rule
PSAvoidUsingEmptyCatchBlock
Issue
Multiple files contain empty
catchblocks that silently swallow exceptions. This violates PowerShell error handling best practices and can make debugging extremely difficult.Affected Files
Eigenverft.Manifested.Agent.InvokeCodexTask.ps1
Lines 633-635:
Eigenverft.Manifested.Agent.InvokeGeminiTask.ps1
Lines 653-655:
Eigenverft.Manifested.Agent.ps1
Lines 11-13:
Problems
PSAvoidUsingEmptyCatchBlockRecommended Fix
Even if errors are expected and should be ignored, they should be logged:
PSScriptAnalyzer Rule
PSAvoidUsingEmptyCatchBlock