Skip to main content

Fix: uis.ps1 Fails on Windows Due to $ErrorActionPreference = "Stop"

IMPLEMENTATION RULES: Before implementing this plan, read and follow:

Status: Complete

Goal: Fix PowerShell scripts so they don't crash when Docker writes to stderr on first run.

Last Updated: 2026-03-04

GitHub Issue: #62

Investigation: INVESTIGATE-uis-ps1-erroractionpreference


Problem Summary

$ErrorActionPreference = "Stop" in three PowerShell scripts causes Docker stderr output to terminate the script. On first run, docker image inspect and docker rm -f write expected error messages to stderr, which kills the script before fallback logic executes.

Affected files:

  • uis.ps1 (repo root) — 26 Docker calls, 17 with no stderr handling
  • website/static/uis.ps1 — canonical version users download via install.ps1
  • website/static/install.ps1 — installer script

Phase 1: Remove $ErrorActionPreference = "Stop" — ✅ DONE

Tasks

  • 1.1 In uis.ps1 (root, line 7): delete $ErrorActionPreference = "Stop"
  • 1.2 In website/static/uis.ps1 (line 16): delete $ErrorActionPreference = "Stop"
  • 1.3 In website/static/install.ps1 (line 14): delete $ErrorActionPreference = "Stop"

Validation

Verify no other code in these files depends on $ErrorActionPreference = "Stop". All critical Docker failures are already handled by $LASTEXITCODE checks.


Phase 2: Verify and commit — ✅ DONE

Tasks

  • 2.1 Verify uis.ps1 (root) has $LASTEXITCODE checks after critical Docker commands (docker pull, docker run)
  • 2.2 Verify website/static/uis.ps1 has $LASTEXITCODE checks after critical Docker commands
  • 2.3 Verify website/static/install.ps1 has $LASTEXITCODE checks after docker pull
  • 2.4 Commit, push, and close issue #62

Validation

website/build/ is regenerated by Docusaurus build — confirm the fix propagates by running cd website && npm run build.


Acceptance Criteria

  • All three files no longer have $ErrorActionPreference = "Stop"
  • docker image inspect failure on first run doesn't crash the script
  • docker rm -f on nonexistent container doesn't crash the script
  • Critical Docker failures (pull fails, run fails) still produce error messages and exit
  • Issue #62 closed

Files to Modify

FileChange
uis.ps1Remove $ErrorActionPreference = "Stop" (line 7)
website/static/uis.ps1Remove $ErrorActionPreference = "Stop" (line 16)
website/static/install.ps1Remove $ErrorActionPreference = "Stop" (line 14)