openclaw - ✅(Solved) Fix v2026.5.7 update wipes entire openclaw.json config — agents, channels, plugins, credentials all lost [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#80077Fetched 2026-05-11 03:19:03
View on GitHub
Comments
1
Participants
2
Timeline
9
Reactions
2
Timeline (top)
referenced ×7commented ×1cross-referenced ×1

Fix Action

Workaround

Restored config and credentials from an external OneDrive backup. Had to manually disable auto-updates after recovery:

openclaw config set update.auto.enabled false
openclaw config set update.checkOnStart false

PR fix notes

PR #80257: fix: prevent config data loss during version upgrade

Description (problem / solution / changelog)

Summary

When upgrading from v2026.5.6 to v5.7+, the update-triggered doctor --fix run can destroy user-authored config fields in openclaw.json. Users report losing channel accounts, credentials, and plugin install records after upgrade.

Root Cause

Four interacting problems in the update-triggered doctor flow:

  1. stripUnknownConfigKeys() runs before migration — The new version's stricter Zod schema (via .strict()) doesn't recognize plugins.installs (moved to a state file in v5.7). The strip function at doctor-config-analysis.ts:62 deletes it as "unknown" before ensureShippedPluginInstallConfigRecordsMigratedForWrite gets a chance to migrate it.

  2. Doctor gets write privileges during updateupdate-command.ts:1606-1619 sets both OPENCLAW_UPDATE_IN_PROGRESS=1 and UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE=1, bypassing the legacy skip guard at doctor-health-contributions.ts:57-67.

  3. allowConfigSizeDrop: true disables safety netdoctor-health-contributions.ts:598 sets this when shouldWriteConfig is true, bypassing the >50% size-reduction rejection that would otherwise catch the data loss.

  4. Backup rotation window too smallCONFIG_BACKUP_COUNT = 5 in backup-rotation.ts. During upgrade, doctor/channel-persist/restart may write config multiple times, rotating the good pre-upgrade .bak files out of the 5-slot ring before the user notices.

Fix

Four defense layers, each independently sufficient to prevent the reported data loss:

Layer 1: Pre-update persistent snapshot

# src/config/backup-rotation.ts — new function
+export async function createPreUpdateConfigSnapshot(params: {
+  configPath: string;
+  writeFile: ...; readFile: ...; existsSync: ...;
+}): Promise<void>

Creates .pre-update snapshot outside the .bak rotation ring before any update writes. Survives unlimited subsequent config writes. Best-effort (failure doesn't block update).

Called from update-command.ts before doctor invocation.

Layer 2: Skip strip during update (root cause)

# src/commands/doctor-config-analysis.ts
 export function stripUnknownConfigKeys(...) {
+  if (isUpdateInProgress()) {
+    return { cfg: params.cfg, removed: [], warnings: [] };
+  }

During upgrade, the new schema legitimately doesn't know about keys awaiting migration. Normal doctor --fix still cleans up after upgrade completes.

Layer 3: Disable allowConfigSizeDrop during update

# src/flows/doctor-health-contributions.ts
-allowConfigSizeDrop: ctx.configResult.shouldWriteConfig === true,
+allowConfigSizeDrop:
+  ctx.configResult.shouldWriteConfig === true &&
+  !isUpdateDoctorRun(ctx.env ?? process.env),

Even if something else unexpectedly shrinks config during update, the write is rejected rather than silently losing data.

Layer 4: Whitelist plugins.installs from strip

# src/commands/doctor-config-analysis.ts
+const STRIP_PROTECTED_KEYS: ReadonlyMap<string, ReadonlySet<string>> = new Map([
+  ["plugins", new Set(["installs"])],
+]);

plugins.installs is managed by the install-record migration system and should never be treated as unknown, even outside of update flows.

Tests

  • config.backup-rotation.test.ts: 3 new tests — snapshot creation with correct permissions, survival through rotation cycles, no-op on missing config
  • doctor-config-analysis.test.ts: 4 new tests — env guard (1 and true), normal stripping preserved, plugins.installs whitelist
  • doctor-health-contributions.test.ts: 2 new tests — allowConfigSizeDrop disabled during update, enabled otherwise

All 4 test suites pass (49 total tests, 0 failures):

pnpm test src/config/config.backup-rotation.test.ts        # 7 pass
pnpm test src/commands/doctor-config-analysis.test.ts       # 7 pass
pnpm test src/flows/doctor-health-contributions.test.ts     # 11 pass
pnpm test src/cli/update-cli/update-command.test.ts         # 24 pass (existing, no regression)

Fixes #80077

Changed files

  • src/cli/update-cli/update-command.ts (modified, +11/-0)
  • src/commands/doctor-config-analysis.test.ts (modified, +68/-1)
  • src/commands/doctor-config-analysis.ts (modified, +18/-0)
  • src/config/backup-rotation.ts (modified, +33/-0)
  • src/config/config.backup-rotation.test.ts (modified, +86/-0)
  • src/flows/doctor-health-contributions.test.ts (modified, +85/-1)
  • src/flows/doctor-health-contributions.ts (modified, +8/-1)

Code Example

openclaw config set update.auto.enabled false
openclaw config set update.checkOnStart false
RAW_BUFFERClick to expand / collapse

Bug Report

Version: 2026.5.6 → 2026.5.7 (auto-update via npm) Platform: macOS (arm64), Mac mini Severity: Critical — full outage

What Happened

After the automatic update to 2026.5.7, the ~/.openclaw/openclaw.json config was effectively reset, wiping nearly all user configuration. The ~/.openclaw/credentials/ directory was also deleted.

What Was Lost

The following top-level config keys were stripped from openclaw.json:

  • channels — Telegram and WhatsApp configs (all bots went offline)
  • plugins — Only anthropic and ollama survived; lost memory-core, telegram, google, openai, whatsapp, mistral
  • agents — All 9 configured agents wiped (only main remained)
  • bindings — All Telegram routing rules gone
  • cron, commands, env, mcp, messages, secrets, session, skills, talk, tools, wizard — all gone
  • ~/.openclaw/credentials/ directory — deleted entirely (token files, API keys)

Impact

  • All Telegram bots immediately went offline (token tokenFile is configured but unavailable)
  • All 9 agents reduced to just main
  • Memory-core, Google, and all other plugins disabled
  • Complete outage requiring full manual restore from external backup

Steps to Reproduce

  1. Have a configured OpenClaw install with multiple agents, Telegram bots, plugins
  2. Allow auto-update to run (or run openclaw update)
  3. Observe that openclaw.json has been reset and credentials/ directory is gone

Expected Behavior

Updates should migrate and preserve all existing user configuration. At minimum, a pre-update backup should be created that actually contains the pre-update state (the .bak files created during this update already reflected the wiped config, not the original).

Workaround

Restored config and credentials from an external OneDrive backup. Had to manually disable auto-updates after recovery:

openclaw config set update.auto.enabled false
openclaw config set update.checkOnStart false

Request

  1. Fix config migration to preserve existing keys during updates
  2. Ensure the .bak backup is written before any config changes are applied
  3. Never delete the credentials/ directory during an update
  4. Consider a dry-run or diff preview before applying config migrations

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix v2026.5.7 update wipes entire openclaw.json config — agents, channels, plugins, credentials all lost [1 pull requests, 1 comments, 2 participants]