From f56605600fb4d29157297ff06d33136060c64b17 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Mon, 9 Mar 2026 14:12:40 +0100 Subject: [PATCH] Fix host bricked on Factorio version check If the FactorioVersionRequest throws the instance and host ends up bricked as the instance is left in an invalid starting state that can't be stopped. --- packages/host/src/Host.ts | 1 + packages/host/src/Instance.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/host/src/Host.ts b/packages/host/src/Host.ts index 7e778c32..b096a889 100644 --- a/packages/host/src/Host.ts +++ b/packages/host/src/Host.ts @@ -74,6 +74,7 @@ async function discoverInstances(instancesDir: string) { return instances; } +// Requests that wake up the instance is responsible for updating the instance state in case of errors. const instanceStartingMessages = new Set([ lib.InstanceStartRequest.name, lib.InstanceLoadScenarioRequest.name, diff --git a/packages/host/src/Instance.ts b/packages/host/src/Instance.ts index 952470be..782b26a2 100644 --- a/packages/host/src/Instance.ts +++ b/packages/host/src/Instance.ts @@ -637,9 +637,10 @@ end`.replace(/\r?\n/g, " "); } async init(pluginInfos: lib.PluginNodeEnvInfo[]) { + // After changing the status this function is responsible for calling notifyExit if it throws. this.notifyStatus("starting"); - const factorioVersions = await this.sendTo("controller", new lib.FactorioVersionsRequest()); try { + const factorioVersions = await this.sendTo("controller", new lib.FactorioVersionsRequest()); await this._loadStats(); await this.server.checkForUpdates(factorioVersions); await this.server.init();