Pcornel
Automation · Automation Troubleshooting

Script Failure

Cheat sheet · https://pcornel.dk/topic.php?topic=6046

Back to the Topic

Answer

Script Failure isolates interpreter, parsing, control-flow, dependency, command-execution and exit-status failures in a specific script invocation without assuming the last printed error is the root cause.

Remember

  • Non-zero exit ≠ no target-side changes occurred.
  • Last stack-frame message ≠ earliest causal failure.
  • Script runs interactively ≠ automation invocation has identical environment.
  • Exit code 0 ≠ desired state verified.

First checks

  • bash -x script.sh / Set-PSDebug -Trace 1 / python3 -m pdb — trace
  • Exit code and stderr — error
  • Environment differences (PATH, user, cwd) — context

Commands

python -c "import ast,pathlib; ast.parse(pathlib.Path('<script.py>').read_text())"
Read-only/validation observation for Python parser result for the selected source file without executing application lo…

Verify in this order

script → error → trace → fix

Where it usually breaks

A script error proves only the observed invocation failed at or after a recorded boundary; it does not prove earlier operations were rolled back or that later targets were untouched.

Script/input → command/module binding → local/remoting session → request accepted → command result → target object read-back → effective runtime state → workload.

Script Failure troubleshooting proof-boundary map

BoundaryHealthy evidenceSuspicious evidence
Symptom / scopeTime window, immutable source/run identity, effective inputs and exact targets are explicitFloating source, changed inputs or ambiguous targets destroy reproducibility
First failed boundaryTransport/auth/dependency/render/operation evidence identifies the earliest divergenceInvestigation starts at the final error and skips earlier unproven boundaries
Effective outcomeController result is paired with target read-back and workload/service acceptanceGreen execution state or changed symptom substitutes for effective-state verification
Recovery / closureMinimal change restores the original test and regression/partial-state checks are cleanBroad retry or unrelated edits make the incident non-reproducible and hide residual state

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6046

Confirmation

Confirm action

Continue?