openclaw - 💡(How to fix) Fix Auth login blocked by size-drop guard when openclaw.json was created by PowerShell (verbose/BOM format) [1 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#71865Fetched 2026-04-26 05:07:23
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

When \openclaw.json\ was originally created by PowerShell (which uses verbose indentation and a UTF-8 BOM), the \openclaw models auth login\ flow silently fails to persist the OAuth token. The login output reports success and a new sha256, but the file is never updated.

Error Message

  • Warn the user that the write was blocked due to size-drop detection.

Root Cause

PowerShell writes \openclaw.json\ with verbose indentation and UTF-8 BOM, producing a file ~59,662 bytes. The auth login flow rewrites the config using standard 2-space JSON indentation (~19,829 bytes — same content, different formatting). OpenClaw's size-drop safety guard detects the ~67% reduction and rejects the write, treating it as potential data loss.

Fix Action

Workaround

Reformat \openclaw.json\ to standard 2-space JSON without BOM using Python before running auth login.

RAW_BUFFERClick to expand / collapse

Summary

When \openclaw.json\ was originally created by PowerShell (which uses verbose indentation and a UTF-8 BOM), the \openclaw models auth login\ flow silently fails to persist the OAuth token. The login output reports success and a new sha256, but the file is never updated.

Version

OpenClaw 2026.4.23 (a979721)

Root Cause

PowerShell writes \openclaw.json\ with verbose indentation and UTF-8 BOM, producing a file ~59,662 bytes. The auth login flow rewrites the config using standard 2-space JSON indentation (~19,829 bytes — same content, different formatting). OpenClaw's size-drop safety guard detects the ~67% reduction and rejects the write, treating it as potential data loss.

Steps to Reproduce

  1. Have \openclaw.json\ created or modified by PowerShell (verify with: check for BOM at byte offset 0 and deeply indented values).
  2. Run \openclaw models auth login --provider openai-codex\ and complete the OAuth flow.
  3. Observe the login reports success with a new sha256, but \openclaw.json\ is not actually updated.
  4. Run \openclaw doctor\ — auth still shows expired.

Expected Behavior

The auth login flow should either:

  • Normalize the config file format before performing the size comparison, or
  • Use content-diff rather than byte-size-diff as the change-safety signal, or
  • Warn the user that the write was blocked due to size-drop detection.

Actual Behavior

Write is silently rejected. Login appears to succeed in the terminal but nothing persists.

Impact

Users who edit config via PowerShell (common on Windows) cannot persist OAuth tokens until they manually reformat the config file.

Workaround

Reformat \openclaw.json\ to standard 2-space JSON without BOM using Python before running auth login.

extent analysis

TL;DR

Reformat the openclaw.json file to standard 2-space JSON without UTF-8 BOM to prevent the size-drop safety guard from rejecting the write.

Guidance

  • Verify the presence of a UTF-8 BOM at byte offset 0 in the openclaw.json file to confirm it was created or modified by PowerShell.
  • Use a tool like Python to reformat the openclaw.json file to standard 2-space JSON without BOM before running the openclaw models auth login command.
  • Run openclaw doctor after completing the OAuth flow to ensure the auth token is persisted correctly.
  • Consider normalizing the config file format before performing the size comparison or using content-diff instead of byte-size-diff as the change-safety signal to prevent similar issues in the future.

Example

import json

with open('openclaw.json', 'r', encoding='utf-8-sig') as f:
    config = json.load(f)

with open('openclaw.json', 'w', encoding='utf-8') as f:
    json.dump(config, f, indent=2)

Notes

This workaround assumes that the issue is solely due to the size-drop safety guard rejecting the write. If other factors are contributing to the problem, additional debugging may be necessary.

Recommendation

Apply the workaround by reformating the openclaw.json file to standard 2-space JSON without BOM before running the openclaw models auth login command, as this is a reliable and straightforward solution to the problem.

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