Repository navigation
Description
Bug type
Regression (worked before, now fails)
Beta release blocker
No
Summary
Environment
- OpenClaw: 2026.7.1
- llama.cpp: b9997 (cb489bc0f)
- LiteLLM (OpenAI-compatible)
- llama-swap
Problem
OpenClaw sends a tool schema for the built-in cron tool that contains:
json
"declarationKey": {
"type": "string",
"minLength": 1,
"maxLength": 200,
"pattern": "\\S"
}
Steps to reproduce
Configure the request path, for example:
OpenClaw → LiteLLM (optional) → llama.cpp
Use a recent llama.cpp build:
version 9997
commit cb489bc0f
Send a normal chat-completions request with OpenClaw’s built-in tools enabled, cron disabled.
Verify that the request succeeds.
Add the built-in cron tool to the same request.
Expected behavior
Adding the built-in cron tool should not make otherwise valid chat completion requests fail. The generated tool schema should be accepted by OpenAI-compatible backends, including llama.cpp.
Since minLength: 1 is already present, the pattern: "\S" constraint appears unnecessary and could be removed, or replaced with a regex compatible with llama.cpp’s supported JSON Schema subset.
Actual behavior
Status Code 400 on llama.cpp end
Unable to generate parser for this template.
Automatic parser generation failed:
JSON schema conversion failed:
Pattern must start with '^' and end with '$'
OpenClaw version
2026.7.1
Operating system
macOS 26.5.2 + Debian 13
Install method
mac app, debian user-based setup
Model
ornith-1.0-35b,minimax-m2.7
Provider / routing chain
OpenClaw → LiteLLM → llama.cpp
Additional provider/model setup details
you can left out LiteLLM in that path as the error generate out of llama.cpp
Logs
2:01:55 - LiteLLM Proxy:ERROR: common_request_processing.py:741 - litellm.proxy.proxy_server._handle_llm_api_exception(): Exception occured - litellm.BadRequestError: OpenAIException - Unable to generate parser for this template. Automatic parser generation failed: JSON schema conversion failed:
Pattern must start with '^' and end with '$'. Received Model Group=coder
Available Model Group Fallbacks=None
Traceback (most recent call last):
File "/app/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 1065, in async_streaming
headers, response = await self.make_openai_chat_completion_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<4 lines>...
)
^
File "/app/.venv/lib/python3.13/site-packages/litellm/litellm_core_utils/logging_utils.py", line 289, in async_wrapper
result = await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 447, in make_openai_chat_completion_request
raise e
File "/app/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 427, in make_openai_chat_completion_request
raw_response = await openai_aclient.chat.completions.with_raw_response.create(**data, timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.13/site-packages/openai/_legacy_response.py", line 384, in wrapped
return cast(LegacyAPIResponse[R], await func(*args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.13/site-packages/openai/resources/chat/completions/completions.py", line 2714, in create
return await self._post(
^^^^^^^^^^^^^^^^^
...<49 lines>...
)
^
File "/app/.venv/lib/python3.13/site-packages/openai/_base_client.py", line 1913, in post
return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.13/site-packages/openai/_base_client.py", line 1698, in request
raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'error': {'code': 400, 'message': "Unable to generate parser for this template. Automatic parser generation failed: JSON schema conversion failed:\nPattern must start with '^' and end with '$'", 'type': 'invalid_request_error'}}
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/.venv/lib/python3.13/site-packages/litellm/main.py", line 639, in acompletion
response = await init_response
^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 1115, in async_streaming
raise OpenAIError(
...<4 lines>...
)
litellm.llms.openai.common_utils.OpenAIError: Error code: 400 - {'error': {'code': 400, 'message': "Unable to generate parser for this template. Automatic parser generation failed: JSON schema conversion failed:\nPattern must start with '^' and end with '$'", 'type': 'invalid_request_error'}}Screenshots, recordings, and evidence
No response
Impact and severity
No response
Additional information
No response
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
Artyomkun commentedon Jul 14, 2026
This is a llama.cpp parser limitation, not an OpenClaw bug. \S is a valid JSON Schema pattern. If llama.cpp requires ^...$, it should be fixed there. OpenClaw shouldn't have to special-case each backend."
Patt92 commentedon Jul 14, 2026
I agree that \S is a valid JSON Schema pattern.
However, this appears to be a regression from the OpenClaw side from a user perspective. The exact same setup (LiteLLM → llama-swap → llama.cpp) worked with OpenClaw 2026.6.11 and started failing after upgrading to 2026.7.1.
I bisected the generated tool schemas and isolated the failure to the built-in cron tool. Removing only cron makes the same request succeed again.
So while llama.cpp is stricter than some providers, OpenClaw changed something that now triggers this incompatibility. Since llama.cpp is a commonly used local OpenAI-compatible backend, I think it’s worth considering whether the generated schema can be made more portable, or at least documenting the limitation
Artyomkun commentedon Jul 14, 2026
I see your point — and you're right that
\Sis valid JSON Schema.But the fact that it worked in
2026.6.11and broke in2026.7.1makes it a regression on the OpenClaw side, even if the root cause is in llama.cpp's parser.The change that introduced this pattern wasn't tested against real backends — and that's the core process issue here.
I agree with your suggestion: since
minLength: 1already covers the intent,pattern: "\S"is redundant and can be removed.That way, we:
Artyomkun commentedon Jul 14, 2026
And if I wrote, I would write
zodschemesfix(agents,cron): remove pattern field from JSON Schema string constr…
tyukara commentedon Jul 14, 2026
Hi, I experienced the exact same issue within hours of the v2026.7.1 release.
Setup: LM Studio + Qwen3.6-35B-A3B
Error received:
I rolled back the version temporarily and am currently running on a prior release without issues. Just wanted to add my confirmation that this affects real-world local setups too — not just LiteLLM proxy paths.
Patt92 commentedon Jul 14, 2026
also comment in #106779
#106779 (comment) is a compat fix, which works.
I applied a fix on the other end as a callback in LiteLLM, but adding the compat settings in model section is less work, except you have lots of models
llamacpp_schema_compat.py
clawsweeper commentedon Jul 14, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 14, 2026, 12:08 PM ET / 16:08 UTC.
Summary
Keep this issue open: multiple users reproduced the v2026.7.1 local-provider regression, and the linked closing PR remains open rather than merged. The report should stay canonical until that repair or a narrower replacement is proven and lands.
Reproducibility: yes. at source level: include the cron schema containing pattern "\S" in an OpenAI-compatible request to the cited llama.cpp builds and the backend rejects schema conversion with the reported anchored-pattern error. A fresh current-main live run was not captured in this review.
Root-cause cluster
Relationship:
canonicalCanonical: #107449
Summary: This issue provides the precise schema-level root cause; two broader reports show the same failure, while the open PR is the candidate repair.
Members:
fixed_by_candidate: fix(agents,cron): remove pattern field from model-facing cron tool schema #107605 - The open PR explicitly closes this issue and changes the identified pattern-bearing schemas.duplicate: [Bug]: Unable to connect to llama.cpp #107430 - It reports the same llama.cpp anchored-pattern rejection and is linked to the same candidate fix.same_root_cause: Issue with 2026.7.1 #106779 - It reports the v2026.7.1 llama.cpp parser failure and contains the compatibility-setting workaround referenced here.superseded: fix(agents,cron): remove pattern field from JSON Schema string constraints #107466 - This closed, unmerged earlier repair iteration was replaced by the focused open candidate.superseded: fix(agents,cron): remove pattern field from JSON Schema string constraints #107468 - This closed, unmerged iteration used the earlier candidate head and was replaced by the focused open PR.Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.
Next step
The open closing PR already owns the implementation path, so maintainers should review its validation semantics and request real backend proof rather than queueing another fix PR.
Review details
Best possible solution:
Preserve the intended nonblank-string contract with a llama.cpp-compatible anchored constraint or an established centralized schema-compatibility path, add focused generated-schema coverage, and prove a real request against llama.cpp or LM Studio before landing the linked PR or a replacement.
Do we have a high-confidence way to reproduce the issue?
Yes at source level: include the cron schema containing pattern "\S" in an OpenAI-compatible request to the cited llama.cpp builds and the backend rejects schema conversion with the reported anchored-pattern error. A fresh current-main live run was not captured in this review.
Is this the best way to solve the issue?
No, wholesale removal is not yet proven to be the best fix because it weakens nonblank validation across shared schemas; preserving that contract with an anchored portable pattern or established compatibility normalization is safer.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning high; reviewed against 6de8aa6f9b75.
Label changes
Label changes:
P1: The v2026.7.1 regression prevents affected local OpenAI-compatible providers from completing agent requests whenever the incompatible tool schema is included.impact:auth-provider: The failure affects provider/model interoperability and causes configured llama.cpp and LM Studio routes to reject requests before generation.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.clawsweeper:linked-pr-open: Current issue advisory state selects this label.clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.Label justifications:
P1: The v2026.7.1 regression prevents affected local OpenAI-compatible providers from completing agent requests whenever the incompatible tool schema is included.impact:auth-provider: The failure affects provider/model interoperability and causes configured llama.cpp and LM Studio routes to reject requests before generation.Evidence reviewed
What I checked:
src/agents/tools/cron-tool.ts:272, 6de8aa6f9b75)src/agents/tools/cron-tool.ts:272, 055777aa1d5d)packages/gateway-protocol/src/schema/cron.ts, 055777aa1d5d)Likely related people:
src/agents/tools/cron-tool.ts,packages/gateway-protocol/src/schema/cron.ts,packages/gateway-protocol/src/schema/gateway-suspend.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.6 remaining items
lsr911 commentedon Jul 15, 2026
Severity Assessment
This is a regression from 2026.6.11 → 2026.7.1 that blocks ALL llama.cpp / LM Studio / llama-swap users from upgrading. The built-in cron tool generates JSON Schema with unanchored
pattern: "\S"which llama.cpp's parser rejects with:Impact:
Proposed fix: PR #107939 — 3 files, +5/−5 lines, 325 tests passing, clean branch from latest upstream/main
The change is minimal and semantically identical —
\S→^.*\S.*$(same meaning: "at least one non-whitespace character" — with proper anchors)@steipete Could you take a look when you have a moment? This is a small, low-risk fix that unblocks a significant portion of self-hosted users.
lsr911 commentedon Jul 15, 2026
PR comparison: two approaches to the same fix
There are now two PRs addressing this regression:
\S→^.*\S.*$patternentirely" ")Key difference: #108144 only removes the pattern from
cron-tool.ts— the AI-facing tool schema. But the same\Spatterns exist in 4 other locations ingateway-protocol/src/schema/(cron.ts ×3, gateway-suspend.ts ×1). These gateway-protocol schemas are used for RPC validation and would still cause issues if ever exposed through a future API surface.Recommendation: #107939 is the complete fix. It anchors all 5 patterns while preserving identical validation semantics. The anchor approach (
^.*\S.*$) keeps the "at least one non-whitespace character" guard —minLength: 1alone allows whitespace-only strings through.Patt92 commentedon Jul 15, 2026
+1 from my side. PR #107939 is the better approach. It covers the \S pattern while remaining compatible with llama.cpp.
I also agree that the severity should be considered high. This issue doesn’t just affect a niche setup—it impacts everyone using local llama.cpp/llama-server backends, which is a fairly common deployment option. As a result, it affects a significant number of users relying on local inference.
fix(agents,cron): remove pattern field from model-facing cron tool sc…
fix(agents,cron): remove pattern field from model-facing cron tool sc…
fix(agents,cron): remove pattern field from model-facing cron tool sc…
fix(agents,cron): remove pattern field from model-facing cron tool sc…