Windows restarts and crashes
New in v23. This page covers what Starship does when the PC restarts under it, or when Starship itself stops without a clean exit, and what you should set up in Windows so it does not happen on an imaging night.
Twice on a real rig a forced Windows Update restart ended the night mid-run, with the mount left unparked. Everything below exists because of that.
The short version
- Set Windows so it cannot restart the PC during the night. This is the real protection. Starship never changes a Windows setting itself.
- If Windows restarts anyway, Starship has only a few seconds. It stops the run and sends close, park and cover-close. It cannot wait to see them finish.
- If Starship stops unexpectedly (a crash, a kill, out of memory), a small helper process parks the mount and closes the flat cover. It never opens anything.
- The next start tells you what happened, in the Console and by alert.
- A sequence that was cut short can be carried on automatically at the next start, if you turn that on.
Stop Windows restarting the PC at night
Windows Update restarts a PC outside its active hours. Active hours can cover at most 18 hours a day, so they cannot cover every hour. What you can do:
- Set active hours to cover your nights, for example 15:00 to 09:00 (Windows Settings → Windows Update → Advanced options → Active hours). Windows then restarts in the daytime gap.
- Pause updates before a run of clear nights, and install them yourself in the daytime.
- Restart the PC yourself when Windows says a restart is needed. A pending restart is the warning sign.
Starship only reads the state of Windows Update (whether a restart is pending, and the active hours). It never writes the registry and never changes these settings for you.
The pending-restart warning
While Windows has a restart pending, the Console shows a warning: Windows may restart this PC tonight outside its active hours. The health monitor lists it as the windows_restart item, and looks again every five minutes.
Starship counts a restart as pending when Windows Update or Windows component servicing has asked for one. Other pending file operations (installers, antivirus updates) are not counted, because they never make Windows restart the PC by itself.
Unattended starts are refused
With a restart pending, Starship refuses to start a run that is meant to be left alone unless you confirm:
- a blockscript,
- the scheduler,
- a stand-alone sequence that has an end time (
end_by_utc) or a dawn gate (end_sun_alt_deg).
The page asks: restart the PC first, or start anyway. Cancel does not start. OK starts with the risk accepted. From the API the same start is refused with restart_risk: true, and is accepted when sent again with confirm_restart_risk: true.
A sequence with no end time and no dawn gate is not refused. A blockscript set to run again every night is checked when you start it, not again at each dusk. If Starship cannot read the Windows state, nothing is refused.
A blockscript started by [blockscript] auto_start is refused the same way, and there is nobody at the console to confirm. Starship then sends a critical alert saying the blockscript was not started: start it by hand, or restart the PC.
When Windows ends the session
Starship asks Windows to tell it first, before the mount server and other programs. When the notice comes:
- It writes down that this was a Windows restart, so the next start (and the helper below) know it was not a crash.
- It tries to send one alert: the restart is happening and the commands are being sent now.
- It runs the fast make-safe (the four steps below).
- It writes what each step answered to
starship.log.
The fast make-safe, in order:
- Runs. The sequence, blockscript and scheduler are stopped. The plan's
on_enddoes not run; there is no time. - Enclosure. Close is sent. See the note below for an enclosure that needs the mount parked first.
- Mount. Park is sent. If the mount refuses the park, tracking is switched off.
- Cover. Close is sent to the flat cover.
A forced restart gives a program about five seconds and then ends it. Starship allows 3.5 seconds for the commands to be acknowledged. Nothing is read back. The mount may still be slewing to park and the roof still closing when Starship is ended. Check the rig after any Windows restart.
An enclosure that needs the mount parked first. Close is sent straight away only when you have told Starship the enclosure clears the mount in any position: [observatory] park_before_roof_close = false and roof_motion_requires_safe_mount off. Otherwise a close onto an unparked mount could strike the telescope, and there is no time to park first. In that case the enclosure is closed only if the mount already reads parked, and the report says NOT closed.
The same fast make-safe runs when the Starship console window is closed.
If Windows calls the shutdown off, Starship carries on running. The rig has still been made safe and the run has still been stopped; start again when you are ready.
What this cannot cover. If the PC loses power, the power button is held, or Windows crashes, no notice is sent and none of this runs. That case belongs to the helper below and to your hardware's own fail-safes (an enclosure controller that closes by itself, a mount with its own limits).
If Starship stops unexpectedly: the death watch
A separate small process watches Starship. If Starship disappears without a clean stop and does not come back, the helper:
- parks the mount. If the park is refused it switches tracking off;
- closes the flat cover;
- writes what it did to
starship-deathwatch.login the install folder; - queues an alert, which the next Starship sends.
It never opens anything. Park, tracking off and cover close are the only commands it knows. It does not close the roof or dome. It never acts while a Starship is running or starting.
On an installed (compiled) build the helper runs inside the crash watchdog that relaunches Starship. After an unclean stop it parks and closes first, then lets Starship be relaunched. A relaunched Starship sits idle, so without this the mount would track all night.
A deliberate restart (Save+Restart, a health-monitor restart) is not parked. The helper waits for Starship to come back, and acts only if it does not.
In manual mode ([safety] enabled = false) the helper stands down, because a person is at the rig. Set manual_mode = true to keep it.
A mount or cover connected over Alpaca is reached with plain HTTP. An Alpaca server that needs a login is not covered.
The death watch is new in v23.
Settings: [deathwatch]
Settings → Crash protection → If Starship stops unexpectedly has the first four. All are read when Starship starts: save, then restart Starship.
enabled(true) - the helper is on. On the page: Park the mount if Starship stops unexpectedly.park_mount(true) - park the mount (tracking off if the park is refused).close_cover(true) - close the flat cover.grace_s(20) - seconds the helper waits after Starship is gone before it acts.manual_mode(false) - true keeps the helper on in manual mode. Config file only.park_timeout_s(120) - seconds it waits for the park to read back. Config file only.restart_wait_s(120) - after a deliberate restart, seconds it waits for Starship to come back before making the rig safe. Config file only.
What the next start tells you
When the last run of Starship did not end by a normal stop, the next start says so once, in the log, in the Console's command log (PREVIOUS STOP) and as a critical alert:
- after a Windows restart or a closed console window: when it happened and what each fast make-safe step answered, with the reminder that nothing was read back;
- after an unclean stop: the time of the last log line, and that the mount may still be tracking and the cover open.
Alerts that could not be sent
An alert that fails on every channel is kept and tried again: after 30 s, 1, 2, 5 and 10 minutes, then every 15 minutes. It is given up after 12 tries or 24 hours. A late alert is marked [delayed - first tried HH:MM]. At most 50 are kept.
The queue is a file in the install folder (starship.alerts.outbox.json), so it survives a restart. That is how the alert about a Windows restart, and the one the death watch queues, reach you after the network or the PC comes back.
Carrying on after a restart (opt-in)
Off by default. Turn it on in Settings → Sequencer defaults → Resume a sequence cut short by a restart ([sequencer] auto_resume_after_restart). The second field, auto_resume_max_age_h (default 6), is how old an interrupted run may be.
It is checked once, at start, after Starship has a safety verdict (it waits up to a minute for one). It resumes only when all of these hold:
- A stand-alone sequence was running when Starship or the PC went down. Its checkpoint shows the run did not end while Starship was alive.
- The interruption was less than
auto_resume_max_age_hhours ago. - The saved plan still matches the checkpoint (it was not edited).
- No blockscript is running, and
[blockscript] auto_startis not set. - Safety reads SAFE (when safety is on).
- It is dark: the Sun is below the plan's dawn gate, or, when the plan has none, below the darkness limit used after bad weather (
[performance] weather_resume_dark_sun_alt_deg, -18° by default). - The plan's end time has not passed.
- Windows has no restart pending.
It will not resume:
- a run you stopped, a run that failed, or a run that reached its end time or dawn;
- a run that was going when you shut Starship down or restarted it on purpose (it is stopped and marked first);
- a blockscript's sequence or a scheduler chunk. Those keep no checkpoint. Use
[blockscript] auto_startfor an unattended night: the blockscript starts again from its startup list and the scheduler keeps its frame counts; - when no site is set and the plan has no end time, because darkness cannot be known.
The resume is the same as pressing Resume: on_start runs again (open, unpark, cool), the run re-points at the interrupted target and skips the subs already taken. The journal and a warning alert say that it resumed and from which step. If nothing is resumed, the log says why.
Auto-resume is new in v23.
Files
In the install folder (the working directory):
starship.log- the main log. The fast make-safe report is here.starship-deathwatch.log- what the helper saw and did.starship.alerts.outbox.json- alerts waiting to be sent again. Removed when empty.
See also
- Health monitor - the
windows_restartitem, and Starship's own restarts. - Sequencer - checkpoint and Resume.
- Alerts - channels and conditions.