openclaw - 💡(How to fix) Fix System attempting to JSON-parse Markdown (.md) files in workspace context [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#71562Fetched 2026-04-26 05:11:27
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0

Error Message

  • Error messages indicate attempts to parse Markdown as JSON

Fix Action

Fix / Workaround

CURRENT WORKAROUND:

  • Renamed TOOLS.md to TOOLS.txt to avoid JSON parsing
  • Created task-tracking-config.json for configuration instead of Markdown
  • But this shouldn't be necessary — .md files should never be JSON-parsed
RAW_BUFFERClick to expand / collapse

OPENCLAW BUG REPORT

TITLE: System attempting to JSON-parse Markdown (.md) files in workspace context

SEVERITY: High (breaks workspace file loading)

DESCRIPTION: The OpenClaw system is attempting to parse Markdown (.md) files as JSON, causing "Expected ',' or ']' after array element in JSON" errors.

AFFECTED FILES:

  • TOOLS.md (triggered multiple parse errors)
  • Potentially all .md files in workspace root

EXPECTED BEHAVIOR:

  • Only .json files should be JSON-parsed
  • .md files should be treated as plain text
  • No parsing errors on legitimate workspace configuration files

ACTUAL BEHAVIOR:

  • System throws JSON parse errors when loading/processing .md files
  • Error messages indicate attempts to parse Markdown as JSON
  • This affects ANY .md file in the workspace root

EXAMPLE ERRORS:

  • "Expected ',' or ']' after array element in JSON at position 1385"
  • "Expected ',' or '}' after property value in JSON at position 3342"
  • Multiple errors at different positions when reading TOOLS.md

CURRENT WORKAROUND:

  • Renamed TOOLS.md to TOOLS.txt to avoid JSON parsing
  • Created task-tracking-config.json for configuration instead of Markdown
  • But this shouldn't be necessary — .md files should never be JSON-parsed

REPRODUCIBILITY:

  • Create or edit any .md file in workspace root
  • System attempts to load it and parses as JSON
  • Errors occur

REQUESTED FIX: Add file extension check before JSON parsing. Only parse .json files as JSON.

extent analysis

TL;DR

Implement a file extension check to only parse files with the .json extension as JSON, skipping files with the .md extension.

Guidance

  • Verify that the current implementation does not have a file extension check before attempting to parse files as JSON.
  • Add a conditional statement to check the file extension before parsing, ensuring only .json files are parsed as JSON.
  • Consider adding a logging mechanism to track files that are skipped due to not being .json files, for debugging purposes.
  • Review the current file loading and processing logic to ensure it correctly handles files of different types, including Markdown files.

Example

if (file.endsWith('.json')) {
  // Attempt to parse as JSON
} else {
  // Handle as plain text or skip, depending on the file type
}

Notes

This fix assumes that the issue is solely due to the lack of a file extension check. If other file types are also being incorrectly parsed, additional checks may be necessary.

Recommendation

Apply a workaround by adding a file extension check to only parse .json files as JSON, as this directly addresses the reported issue and prevents unnecessary parsing attempts on Markdown files.

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 - 💡(How to fix) Fix System attempting to JSON-parse Markdown (.md) files in workspace context [1 participants]