You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2026-04-24T14:32:11.587+08:00 warn plugins {"subsystem":"plugins"} memos-local: could not patch tools.allow: SyntaxError: Expected double-quoted property name in JSON at position 2222 (line 90 column 7)
How to Reproduce | 如何重现
openclaw.json文件里添加 // 这样的注释,必现。
Environment | 环境信息
最新版本(2026-04-24)
Additional Context | 其他信息
No response
Willingness to Implement | 实现意愿
I'm willing to implement this myself | 我愿意自己解决
I would like someone else to implement this | 我希望其他人来解决
Summary: Fix issue #1543: memos-local-openclaw plugin now reads ~/.openclaw/openclaw.json as JSON5 instead of strict JSON.
Root cause: OpenClaw's host config is officially JSON5 (allows // and /* */ comments, single-quoted strings, unquoted identifier keys, trailing commas). The plugin previously called strict JSON.parse on the file in six places, including the tools.allow patcher that runs on every plugin startup — which is what produced the reported warning memos-local: could not patch tools.allow: SyntaxError: Expected double-quoted property name in JSON at position 2222 (line 90 column 7) whenever a user kept comments in their config.
Fix:
New zero-dependency src/shared/json5.ts provides parseJsonOrJson5 — a strict-JSON fast path with a JSON5-tolerant fallback that strips comments via a string-respecting state machine, rewrites single quotes, quotes unquoted identifier keys, and tolerates trailing commas and UTF-8 BOM.
New src/shared/openclaw-config.ts extracts the tools.allow patch logic into a unit-testable helper that anchors on both double- and single-quoted last entries and tolerates trailing commas. It never throws.
All six JSON.parse(fs.readFileSync(<openclaw.json>...)) call sites are routed through the new helper: index.ts, src/shared/llm-call.ts, src/ingest/providers/index.ts, and six endpoints inside src/viewer/server.ts. Plain-JSON configs are unaffected thanks to the fast path.
Tests added (21 new, all green): tests/json5-config.test.ts covers the issue case, block comments, trailing commas, single/mixed quotes, unquoted keys, BOM, the classic "// inside a URL string literal" bug, malformed input, and an end-to-end exercise of loadOpenClawFallbackConfig. tests/openclaw-config-patch.test.ts covers the patcher across comments, single quotes, trailing commas, and the no-op paths (*, already-present, empty, malformed). Regression sweep across openclaw-fallback, config, viewer-config, storage, policy, capture, recall, chunker, migration-status, postinstall-native-binding — 105 tests pass; tsc --noEmit clean.
Summary: Fixes MemOS issue #1543: the memos-local-openclaw-plugin used raw JSON.parse when reading the user's openclaw.json, so any config with // line comments, single-quoted strings or trailing commas caused SyntaxError: Expected double-quoted property name at startup, silently disabling the tools.allow patch step and blocking plugin tools.
The fix introduces a small shared helper apps/memos-local-openclaw/src/shared/openclaw-config.ts that parses openclaw.json with json5@^2.2.3 (strict JSON is a subset, so nothing regresses), and routes all runtime + script read sites through it: index.ts (tools.allow patch), src/shared/llm-call.ts, src/ingest/providers/index.ts, src/viewer/server.ts, plus the four scripts/*.ts maintenance scripts. The regex-based tools.allow insertion is left untouched for the common double-quoted case; when the regex cannot safely locate the insertion point, we now log a clear warn asking the user to add "group:plugins" manually instead of silently doing nothing.
Test evidence: npx tsc --noEmit clean; new file tests/openclaw-json5.test.ts adds 11 cases covering line/block comments, single-quoted keys/values, trailing commas, unquoted identifier keys, and end-to-end loadOpenClawFallbackConfig on a JSON5 config — 11/11 pass. Existing tests/openclaw-fallback.test.ts (16/16), tests/viewer-config.test.ts, tests/config.test.ts, tests/integration.test.ts (26/26) all still pass. The 5 unrelated failures in the full vitest run (task-processor, accuracy, skill-auto-install, update-install) touch none of the modified files; they are pre-existing environmental flakes (native binding / process signals / embedding accuracy).
Activity
zzyyll2 commentedon Apr 24, 2026
WEB界面保存配置的时候也是这个报错,没有测试过吗,你们的openclaw.json都是非常标准的JOSN,而非JSON5吗
MaiHHConnect commentedon Apr 25, 2026
Memtensor-AI commentedon Jun 30, 2026
🤖 AutoDev has picked up this issue and started working on it.
Task ID:
8ac61a4dda0016a5Working branch:
bugfix/autodev-1543Target branch:
latest dev* branchWorkflow: opsp (analysis → coding → testing → PR)
I will post the PR link here once done. If I need more information, I will ask in the comments.
fix(memos-local-openclaw): parse openclaw.json as JSON5 (#1543)
Memtensor-AI commentedon Jun 30, 2026
✅ AutoDev task
8ac61a4dda0016a5completed.Summary: Fix issue #1543: memos-local-openclaw plugin now reads ~/.openclaw/openclaw.json as JSON5 instead of strict JSON.
Root cause: OpenClaw's host config is officially JSON5 (allows
//and/* */comments, single-quoted strings, unquoted identifier keys, trailing commas). The plugin previously called strictJSON.parseon the file in six places, including thetools.allowpatcher that runs on every plugin startup — which is what produced the reported warningmemos-local: could not patch tools.allow: SyntaxError: Expected double-quoted property name in JSON at position 2222 (line 90 column 7)whenever a user kept comments in their config.Fix:
src/shared/json5.tsprovidesparseJsonOrJson5— a strict-JSON fast path with a JSON5-tolerant fallback that strips comments via a string-respecting state machine, rewrites single quotes, quotes unquoted identifier keys, and tolerates trailing commas and UTF-8 BOM.src/shared/openclaw-config.tsextracts thetools.allowpatch logic into a unit-testable helper that anchors on both double- and single-quoted last entries and tolerates trailing commas. It never throws.JSON.parse(fs.readFileSync(<openclaw.json>...))call sites are routed through the new helper:index.ts,src/shared/llm-call.ts,src/ingest/providers/index.ts, and six endpoints insidesrc/viewer/server.ts. Plain-JSON configs are unaffected thanks to the fast path.Tests added (21 new, all green):
tests/json5-config.test.tscovers the issue case, block comments, trailing commas, single/mixed quotes, unquoted keys, BOM, the classic "// inside a URL string literal" bug, malformed input, and an end-to-end exercise ofloadOpenClawFallbackConfig.tests/openclaw-config-patch.test.tscovers the patcher across comments, single quotes, trailing commas, and the no-op paths (*, already-present, empty, malformed). Regression sweep acrossopenclaw-fallback,config,viewer-config,storage,policy,capture,recall,chunker,migration-status,postinstall-native-binding— 105 tests pass;tsc --noEmitclean.Base branch:
mainBranch:
bugfix/autodev-1543Commit:
07b5e16PR: #1990
Assigned to: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller
Reviewers: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller
Fix #1543: fix: MEMOS不支持JSON5格式的openclaw.json (#1990)
Memtensor-AI commentedon Jul 2, 2026
🤖 AutoDev has picked up this issue and started working on it.
Task ID:
fde1c36c0dd31bb1Working branch:
bugfix/autodev-1543Target branch:
latest dev* branchWorkflow: opsp (analysis → coding → testing → PR)
I will post the PR link here once done. If I need more information, I will ask in the comments.
fix: accept JSON5 syntax in openclaw.json (MemTensor#1543)
Memtensor-AI commentedon Jul 2, 2026
✅ AutoDev task
fde1c36c0dd31bb1completed.Summary: Fixes MemOS issue #1543: the
memos-local-openclaw-pluginused rawJSON.parsewhen reading the user'sopenclaw.json, so any config with//line comments, single-quoted strings or trailing commas causedSyntaxError: Expected double-quoted property nameat startup, silently disabling thetools.allowpatch step and blocking plugin tools.The fix introduces a small shared helper
apps/memos-local-openclaw/src/shared/openclaw-config.tsthat parses openclaw.json withjson5@^2.2.3(strict JSON is a subset, so nothing regresses), and routes all runtime + script read sites through it:index.ts(tools.allow patch),src/shared/llm-call.ts,src/ingest/providers/index.ts,src/viewer/server.ts, plus the fourscripts/*.tsmaintenance scripts. The regex-basedtools.allowinsertion is left untouched for the common double-quoted case; when the regex cannot safely locate the insertion point, we now log a clearwarnasking the user to add"group:plugins"manually instead of silently doing nothing.Test evidence:
npx tsc --noEmitclean; new filetests/openclaw-json5.test.tsadds 11 cases covering line/block comments, single-quoted keys/values, trailing commas, unquoted identifier keys, and end-to-endloadOpenClawFallbackConfigon a JSON5 config — 11/11 pass. Existingtests/openclaw-fallback.test.ts(16/16),tests/viewer-config.test.ts,tests/config.test.ts,tests/integration.test.ts(26/26) all still pass. The 5 unrelated failures in the full vitest run (task-processor,accuracy,skill-auto-install,update-install) touch none of the modified files; they are pre-existing environmental flakes (native binding / process signals / embedding accuracy).Base branch:
mainBranch:
bugfix/autodev-1543Commit:
95f3fb3PR: #2048
Assigned to: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller
Reviewers: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller