fix: block invalid config startup
Co-authored-by: Muhammed Mukhthar CM <mukhtharcm@gmail.com>
This commit is contained in:
@@ -134,7 +134,7 @@ export async function startGatewayServer(
|
||||
// Ensure all default port derivations (browser/bridge/canvas) see the actual runtime port.
|
||||
process.env.CLAWDBOT_GATEWAY_PORT = String(port);
|
||||
|
||||
const configSnapshot = await readConfigFileSnapshot();
|
||||
let configSnapshot = await readConfigFileSnapshot();
|
||||
if (configSnapshot.legacyIssues.length > 0) {
|
||||
if (isNixMode) {
|
||||
throw new Error(
|
||||
@@ -157,6 +157,19 @@ export async function startGatewayServer(
|
||||
}
|
||||
}
|
||||
|
||||
configSnapshot = await readConfigFileSnapshot();
|
||||
if (configSnapshot.exists && !configSnapshot.valid) {
|
||||
const issues =
|
||||
configSnapshot.issues.length > 0
|
||||
? configSnapshot.issues
|
||||
.map((issue) => `${issue.path || "<root>"}: ${issue.message}`)
|
||||
.join("\n")
|
||||
: "Unknown validation issue.";
|
||||
throw new Error(
|
||||
`Invalid config at ${configSnapshot.path}.\n${issues}\nRun "clawdbot doctor" to repair, then retry.`,
|
||||
);
|
||||
}
|
||||
|
||||
const cfgAtStart = loadConfig();
|
||||
initSubagentRegistry();
|
||||
await autoMigrateLegacyState({ cfg: cfgAtStart, log });
|
||||
|
||||
Reference in New Issue
Block a user