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
{{ message }}
Repository navigation
Bug: Invalid JSON Schema Generated Due to Unsupported Regex Lookaround in fileKey Pattern On GPT 5.5 #31996
When using OpenCode with an OpenAI-compatible provider, requests fail before reaching the model with the following error:
Invalid JSON schema: regex lookaround is not supported.
Found at $.properties.fileKey.pattern
This appears to be caused by OpenCode generating a JSON Schema containing a regex pattern with lookaround assertions ((?=...), (?!...), (?<=...), or (?<!...)).
Many JSON Schema validators used by OpenAI-compatible providers do not support regex lookarounds, causing schema validation to fail before inference begins.
Environment
OpenCode Version: Latest
Provider: OpenAI-compatible API
Model: GPT-5.5
OS: Linux
Steps to Reproduce
Configure OpenCode with an OpenAI-compatible provider.
Start a new session.
Send a simple prompt:
hai
Observe the response.
Actual Result
OpenCode immediately returns:
Invalid JSON schema: regex lookaround is not supported.
Found at $.properties.fileKey.pattern
No request reaches the model.
Expected Result
OpenCode should either:
Generate a JSON Schema compatible with common Structured Output validators, or
Detect unsupported schema features and gracefully fall back to a non-structured-output mode.
The request should not fail before model execution.
Analysis
The error points to:
$.properties.fileKey.pattern
which suggests OpenCode is generating a schema similar to:
The generated regex appears to contain lookaround assertions.
While lookarounds are supported by some regex engines, they are not universally supported by JSON Schema validators used by OpenAI-compatible APIs and structured output implementations.
As a result, schema validation fails before the request can be processed by the model.
Suggested Fix
Avoid generating regex patterns that rely on lookaround assertions.
Replace lookaround-based validation with schema-compatible alternatives.
Add a fallback path when structured output schema validation fails.
Consider validating generated schemas against common OpenAI-compatible implementations before sending requests.
Additional Context
The issue is reproducible with a simple prompt and appears unrelated to the model itself.
Based on the error message, the failure occurs during schema validation rather than inference.
This may affect any OpenAI-compatible provider that enforces JSON Schema validation and does not support regex lookaround syntax.
Plugins
No response
OpenCode version
1.17.4
Steps to reproduce
No response
Screenshot and/or share link
Operating System
No response
Terminal
No response
Reacted by Matt, Rishit Singh, Kristoffer, Francesc Rosas, Nicolas Gimenez, Ilona Shub, Andrew Thompson, Yunus Koçyiğit and Robert
The issue appears to contain AI-generated content (long structured sections like Summary, Analysis, Suggested Fix, Additional Context are a hallmark of AI-generated walls of text, which are not acceptable)
Required fields from the bug report template ("Steps to reproduce", "Operating System", "Terminal") were left as _No response_ placeholder text — please fill these in with real information about your environment and how to reproduce the issue
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
@fresp are you using Figma MCP? I have tested, only Figma MCP cause that error.
I think Figma has change the way they handle MCP request.
Update: I tested with another model in Opencode Go (Figma MCP enabled) -> still work
Maybe the issue only cause with GPTs-model when Figma mcp enabled
Reacted by Kristoffer, Francesc Rosas, Franek Madej, Kacper Kochan, Christoph Bessei, Koen Hendriks and Bryan Eduardo
if i have Figma MCP enabled AND GPT 5.5 i get the error, a bit randomly (or i dont know why), but once it first appeared on a session I cannot get rid of it The session becomes completely unusable. Probably some shit in the context that is unreadable, I have no idea.
when i face the above situation and my session is unusable, and i change model from 5.5 to 5.4, it suddenly starts to work again
when i face the above situation and my session is unusable with model 5.5, and i disable Figma MCP, it suddenly starts to work again
when i face the above situation and my session is unusable, and i solved it with one of the two above solutions, and then i try to go back to 5.5 with Figma MCP enabled, I get the unusable session again with the same error.
Activity
github-actions commentedon Jun 12, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
_No response_placeholder text — please fill these in with real information about your environment and how to reproduce the issuePlease edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
patternfields rejected by OpenAI's validator)additionalProperties: falseis emitted — same class of issue (provider-specific JSON Schema incompatibility requiring sanitization inProviderTransform.schema)If you believe this was flagged incorrectly, please let a maintainer know.
dkornilove commentedon Jun 12, 2026
started to experience after update to 1.17.4.
upd: not really depends on version, looks like some changes on openai side
mattbdc commentedon Jun 12, 2026
It works if you downgrade model to 5.4. It seems an issue with 5.5.
grummans commentedon Jun 12, 2026
@fresp are you using Figma MCP? I have tested, only Figma MCP cause that error.
I think Figma has change the way they handle MCP request.
Update: I tested with another model in Opencode Go (Figma MCP enabled) -> still work
Maybe the issue only cause with GPTs-model when Figma mcp enabled
github-actions commentedon Jun 12, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.
Feel free to open a new issue that follows our issue templates.
nicobao commentedon Jun 12, 2026
why the heck is this closed?
mattbdc commentedon Jun 12, 2026
Their insanity AI decided that a 200+line bug report with positive engagement wasn’t sufficient.
nicobao commentedon Jun 12, 2026
I just tried:
Why?
mattbdc commentedon Jun 12, 2026
Can confirm figma mcp too
kunickiaj commentedon Jun 12, 2026
Patch to fix #30552
santos1982rj commentedon Jun 12, 2026
Eu estava com o mesmo problema, mas no meu caso, foi o Resend MCP. Precisei desabilitar
rekram1-node commentedon Jun 16, 2026
will fix tday
matheuseabra commentedon Jul 27, 2026
I'm havinng this error with dokploy-mcp itself, with gpt-5.6 when I disable it in opencode, it works.