fix(scan): also clear AE AppStates registry to stop Safe Mode 'Crash Repair' dialog
Build backend images / build content-svc (push) Failing after 2m1s
Build backend images / build file-svc (push) Failing after 1m0s
Build backend images / build gateway (push) Failing after 56s
Build backend images / build identity-svc (push) Failing after 54s
Build backend images / build notification-svc (push) Failing after 54s
Build backend images / build render-svc (push) Failing after 46s
Build backend images / build studio-svc (push) Failing after 48s

SCRPriorState.json alone didn't suppress it — AE's per-session GUID under
HKCU\Software\Adobe\After Effects\AppStates persists after a kill/crash and
trips Safe Mode. ClearAECrashState now reg-deletes AppStates too (reg.exe, no dep).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-04 21:21:04 +03:30
parent 47dd87c60b
commit 6e5efbdb2c
2 changed files with 23 additions and 14 deletions
BIN
View File
Binary file not shown.
+20 -11
View File
@@ -2,29 +2,38 @@ package runner
import (
"os"
"os/exec"
"path/filepath"
)
// ClearAECrashState removes After Effects' session crash-recovery marker
// (SCRPriorState.json) from every AE prefs version dir. AE checks this file at
// startup; if it indicates an unclean prior session it shows the blocking
// "Crash Repair Options" dialog — which would hang a headless afterfx/aerender
// launch. Deleting it (vs. wiping all prefs) keeps the node's prefs intact.
// ClearAECrashState removes the markers After Effects uses to decide it crashed,
// so the blocking "Crash Repair Options" (Safe Mode) dialog never appears on a
// headless launch. Two parts:
//
// Safe no-op when APPDATA is unset (non-Windows / dev).
// 1. SCRPriorState.json in each AE prefs version dir (session crash-recovery state).
// 2. HKCU\Software\Adobe\After Effects\AppStates — AE writes a per-session GUID
// subkey on startup and removes it on a clean exit; a leftover one (after a
// kill/crash) triggers Safe Mode. reg.exe is a Windows built-in (no external
// dep / cgo), so we shell out to it.
//
// Targeted (vs. wiping all prefs) so the node keeps its AE preferences. Safe no-op
// on non-Windows (APPDATA unset).
func ClearAECrashState() {
appData := os.Getenv("APPDATA")
if appData == "" {
return
return // non-Windows / dev
}
// 1. session crash-recovery files
base := filepath.Join(appData, "Adobe", "After Effects")
entries, err := os.ReadDir(base)
if err != nil {
return
}
if entries, err := os.ReadDir(base); err == nil {
for _, e := range entries {
if e.IsDir() {
_ = os.Remove(filepath.Join(base, e.Name(), "SCRPriorState.json"))
}
}
}
// 2. registry session/crash state
_ = exec.Command("reg", "delete", `HKCU\Software\Adobe\After Effects\AppStates`, "/f").Run()
}