#9043: fix: graceful degradation when hooks.token is missing
gateway
stale
Cluster:
Gateway and Hooks Enhancements
## 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
#8121: fix(gateway): remove query parameter token support for hooks
by yubrew · 2026-02-03
69.1%
#23410: Gateway: require prefixes for hook request session-key overrides
by bmendonca3 · 2026-02-22
66.6%
#20541: fix(hooks): clear internal hooks before plugins register
by ramarnat · 2026-02-19
66.5%
#10679: fix(hooks): invoke gateway_start and gateway_stop in lifecycle
by yassinebkr · 2026-02-06
63.4%
#22424: fix: prevent crash when onUpdate is truthy but not callable (fixes ...
by mcaxtr · 2026-02-21
62.4%
#21944: feat(gateway): crash-loop protection with escalating backoff
by Protocol-zero-0 · 2026-02-20
62.3%
#14795: fix: skip disabled channel plugins in cross-context messaging checks
by explainanalyze · 2026-02-12
62.2%
#23134: fix(gateway): skip auto-restart for webhook channels that resolve i...
by puneet1409 · 2026-02-22
61.9%
#15722: fix: prefer explicit token over stored device token for remote gate...
by 0xPotatoofdoom · 2026-02-13
61.2%
#21651: fix(gateway): token fallback + operator.admin scope superset in pai...
by lan17 · 2026-02-20
61.1%