← Back to PRs

#9043: fix: graceful degradation when hooks.token is missing

by joetomasone open 2026-02-04 19:56 View on GitHub →
gateway stale
## Problem Fixes #3033 When `hooks.enabled` is `true` but `hooks.token` is not set, the gateway crashes during startup: ``` Gateway failed to start: Error: hooks.enabled requires hooks.token ``` This prevents ALL channels (WhatsApp, Telegram, Signal, etc.) from starting, even though the hooks feature is unrelated to messaging. ## Solution Graceful degradation instead of hard crash: 1. Log a clear warning explaining the issue and how to fix it 2. Return `null` (disable hooks) instead of throwing 3. Allow the rest of the gateway to start normally ```typescript if (!token) { // Graceful degradation: disable hooks instead of crashing const msg = "hooks.enabled is true but hooks.token is missing; hooks feature disabled. " + 'Set hooks.token in config or run "openclaw hooks token" to generate one.'; console.warn(`[hooks] ${msg}`); return null; } ``` ## Behavior Change | Before | After | |--------|-------| | Gateway crashes, all channels down | Warning logged, hooks disabled, channels work | ## Testing 1. Set `hooks.enabled: true` without `hooks.token` 2. Start gateway 3. Verify: warning logged, hooks disabled, other channels functional

Most Similar PRs