Repository navigation
Description
Self Checks
- I have read the Contributing Guide and Language Policy.
- This is only for bug report, if you would like to ask a question, please head to Discussions.
- I have searched for existing issues search for existing issues, including closed ones.
- I confirm that I am using English to submit this report, otherwise it will be closed.
- 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
- Please do not modify this template :) and fill in all the required fields.
Dify version
1.18.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
- Use Dify 1.18.0 with the OpenRouter provider plugin (
langgenius/openrouter). - Pick a model from that plugin, for example
google/gemini-2.5-flash-lite. Its YAML does not liststructured-outputunderfeatures. - Create a workflow with an LLM node that uses this model. Turn on Structured Output and add a JSON schema.
- Run the workflow.
The run fails right away with this error:
Structured output is not supported by model langgenius/openrouter/openrouter/google/gemini-2.5-flash-lite (stage=capability)
The same workflow runs fine on 1.17.1.
✔️ Expected Behavior
The workflow should keep working as it did before the upgrade.
When a model does not say that it supports structured output, Dify already has a fallback: it puts the JSON schema in the prompt (invoke_llm_with_structured_output in api/core/llm_generator/output_parser/structured_output.py).
❌ Actual Behavior
The workflow fails before anything is sent to the model.
The error comes from graphon 0.8.0, in LLMNode._prepare_run_prompt (graphon/nodes/llm/node.py). It rejects every model whose features list does not contain structured-output. This check runs first, so the fallback above is never reached.
Additional context
Why it happens. graphon added this check in langgenius/graphon#237. But many model plugins never declare structured-output, so after upgrading to 1.18.0 workflows that used to work stop working, even though nothing changed on the user's side. See langgenius/dify-official-plugins#4155 (OpenRouter) and langgenius/dify-official-plugins#4143 (openai_api_compatible, fix in progress in langgenius/dify-official-plugins#4146).
Possible fixes.
- In graphon: do not reject the model, let Dify's fallback handle it.
- In Dify: skip this check in
DifyLLMNodeuntil graphon changes. - Keep the check, but make sure the plugins declare the feature, and mention the breaking change in the release notes.
Workaround I tested. I overrode _prepare_run_prompt in DifyLLMNode. It turns the structured output switch off while graphon prepares the prompt, then turns it back on:
@override
def _prepare_run_prompt(self, *, node_inputs):
node_data = self.node_data
switch_on = node_data.structured_output_switch_on
node_data.structured_output_switch_on = False
try:
return (yield from super()._prepare_run_prompt(node_inputs=node_inputs))
finally:
node_data.structured_output_switch_on = switch_onWith this, the workflow runs again and returns the structured result, using the existing fallback.
I can open a PR for option 2 if the maintainers agree.
Activity
[-]LLM node with structured output fails with "Structured output is not supported by model … (stage=capability)" after upgrading to 1.18.0 for models that do not declare `structured-output`[/-][+]Structured output fails with "stage=capability" on 1.18.0 for models that do not declare `structured-output`[/+]wylswz commentedon Nov 12, 2026
Fixed on main by #44962 (merged 2026-10-28, after the 1.18.0 release — so 1.18.0 still has this bug; the fix ships in the next release).
DifyPreparedLLM.get_model_schema()(api/core/workflow/node_runtime.py) now injectsModelFeature.STRUCTURED_OUTPUTinto any model schema that doesn't declare it, so graphon'sstage=capabilitycheck passes and Dify's prompt-based structured-output fallback (invoke_llm_with_structured_output) applies.Verified on current main with an Ollama custom model (no
structured-outputfeature declared): an LLM node with structured output enabled runs successfully. The same path covers the OpenRouter models in this report.PR #45318 proposes an alternative fix (
_prepare_run_promptoverride) but it's redundant given the adapter-side injection; recommend closing it.