openclaw - 💡(How to fix) Fix [Bug]: openclaw doctor fails on large session store with stale sessions.json.*.tmp accumulation [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#56827Fetched 2026-04-08 01:47:21
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
1
Timeline (top)
commented ×1renamed ×1subscribed ×1

openclaw doctor fails on one long-lived installation where ~/.openclaw/agents/main/sessions contains a 154 MB sessions.json and 67 stale sessions.json.*.tmp files totaling about 787 MB.

Root Cause

openclaw doctor fails on one long-lived installation where ~/.openclaw/agents/main/sessions contains a 154 MB sessions.json and 67 stale sessions.json.*.tmp files totaling about 787 MB.

Code Example

ValueDeserializer::ReadObjectWrapper()
ValueDeserializer::ReadValue(...)

---

Observed failure tail:
ValueDeserializer::ReadObjectWrapper()
ValueDeserializer::ReadValue(...)

Measured session-store facts on the affected installation:
- entries in sessions.json: 2378
- top-level key distribution:
  - openresponses: 1236
  - openai: 675
  - discord: 202
  - cron: 194
  - subagent: 47

Largest files in ~/.openclaw/agents/main/sessions included:
- sessions.json154 MB
- multiple sessions.json.<uuid>.tmp files in the 4079 MB range
- largest .jsonl files were roughly 1012 MB
RAW_BUFFERClick to expand / collapse

Bug type

Crash (process/app exits or hangs)

Beta release blocker

No

Summary

openclaw doctor fails on one long-lived installation where ~/.openclaw/agents/main/sessions contains a 154 MB sessions.json and 67 stale sessions.json.*.tmp files totaling about 787 MB.

Steps to reproduce

  1. Use an installation where ~/.openclaw/agents/main/sessions has grown to approximately 1.2 GB total, including a large monolithic sessions.json and many sessions.json.*.tmp files.
  2. Run openclaw doctor.
  3. Observe that doctor fails with a V8 deserialization stack trace ending near ValueDeserializer::ReadObjectWrapper() / ValueDeserializer::ReadValue(...).

Expected behavior

openclaw doctor should complete successfully on long-lived installations with large session history and should not be destabilized by stale sessions.json.*.tmp files.

Actual behavior

openclaw doctor failed, and the observed stack trace ended near:

ValueDeserializer::ReadObjectWrapper()
ValueDeserializer::ReadValue(...)

On the affected installation, the sessions directory measured approximately:

  • total size: ~1.2 GB
  • sessions.json: 154,466,795 bytes
  • sessions.json.*.tmp: 786,956,288 bytes across 67 files
  • *.jsonl: 200,251,621 bytes across 2154 files
  • *.reset.*: 75,188,435 bytes across 48 files

OpenClaw version

2026.3.28

Operating system

Linux arm64

Install method

npm global

Model

openai-codex/gpt-5.4

Provider / routing chain

openclaw -> openai-codex/gpt-5.4

Additional provider/model setup details

NOT_ENOUGH_INFO

Logs, screenshots, and evidence

Observed failure tail:
ValueDeserializer::ReadObjectWrapper()
ValueDeserializer::ReadValue(...)

Measured session-store facts on the affected installation:
- entries in sessions.json: 2378
- top-level key distribution:
  - openresponses: 1236
  - openai: 675
  - discord: 202
  - cron: 194
  - subagent: 47

Largest files in ~/.openclaw/agents/main/sessions included:
- sessions.json — 154 MB
- multiple sessions.json.<uuid>.tmp files in the 40–79 MB range
- largest .jsonl files were roughly 10–12 MB

Impact and severity

Affected: at least one long-lived high-activity installation with a large session store Severity: high (diagnostic command failure) Frequency: observed on the affected installation when running openclaw doctor Consequence: health/diagnostic workflow fails, and the session store can consume significant extra disk space due to stale temp files

Additional information

This appears to have two grounded aspects:

  • openclaw doctor failure on a large session store
  • substantial accumulation of stale sessions.json.*.tmp files

Suggested long-term direction: replace the monolithic sessions.json catalog with a SQLite-backed session metadata store while keeping per-session transcripts as append-only JSONL files. That would allow indexed/incremental reads, safer updates, and lower memory pressure for doctor/status/session inspection paths.

extent analysis

Fix Plan

To address the openclaw doctor failure due to a large session store, we will implement a temporary solution to handle the large sessions.json file and remove stale sessions.json.*.tmp files.

Step 1: Remove Stale Temp Files

Remove the stale sessions.json.*.tmp files to free up disk space and reduce the load on openclaw doctor. This can be done using a script or a one-time command:

find ~/.openclaw/agents/main/sessions -type f -name 'sessions.json.*.tmp' -delete

Step 2: Implement JSON Parsing Limit

Modify the openclaw doctor command to handle large JSON files by increasing the parsing limit or using a streaming JSON parser. For example, using Node.js, you can increase the parsing limit:

const jsonParser = new JSONParser({ maxDepth: 1000 });

Alternatively, consider using a streaming JSON parser like json-stream-parser to parse the large sessions.json file in chunks.

Step 3: Optimize Session Store

As a long-term solution, consider replacing the monolithic sessions.json catalog with a SQLite-backed session metadata store. This will allow for indexed/incremental reads, safer updates, and lower memory pressure for doctor/status/session inspection paths.

Verification

To verify the fix, run the openclaw doctor command after removing the stale temp files and implementing the JSON parsing limit. The command should complete successfully without crashing or hanging.

Extra Tips

  • Consider implementing a periodic cleanup task to remove stale sessions.json.*.tmp files and prevent them from accumulating in the future.
  • When replacing the monolithic sessions.json catalog with a SQLite-backed session metadata store, ensure to handle any potential data migration and compatibility issues.

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…

FAQ

Expected behavior

openclaw doctor should complete successfully on long-lived installations with large session history and should not be destabilized by stale sessions.json.*.tmp files.

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 - 💡(How to fix) Fix [Bug]: openclaw doctor fails on large session store with stale sessions.json.*.tmp accumulation [1 comments, 2 participants]