{"record":{"id":"b2a1ec824923693c","repo":"agentscope-ai/agentscope","slug":"no-structured-output-strategy-is-available-for-se","errorCode":null,"errorMessage":"No structured-output strategy is available for {self.model}.","messagePattern":"No structured-output strategy is available for (.+?)\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/agentscope/model/_base.py","lineNumber":587,"sourceCode":"                            )\n                            await asyncio.sleep(self.retry_delay)\n                            continue\n                        raise  # retries exhausted -> give up\n                    if not isinstance(e, fallback):\n                        raise\n                    # Structured-output compatibility failure: try the next\n                    # strategy.\n                    logger.debug(\n                        \"Structured output strategy '%s' failed for %s: %s. \"\n                        \"Trying next.\",\n                        name,\n                        self.model,\n                        e,\n                    )\n                    break\n\n        if last_error is None:\n            raise RuntimeError(\n                f\"No structured-output strategy is available for \"\n                f\"{self.model}.\",\n            )\n        if first_error is not None and first_error is not last_error:\n            raise last_error from first_error\n        raise last_error\n\n    async def _call_api_with_structured_output(\n        self,\n        model_name: str,\n        messages: list[Msg],\n        structured_model: Type[BaseModel] | dict,\n        tool_choice: ToolChoice | None = None,\n        **kwargs: Any,\n    ) -> StructuredResponse:\n        \"\"\"Run a single structured-output attempt via a forced tool call.\n\n        Constructs a ``generate_structured_output`` tool, asks the LLM to","sourceCodeStart":569,"sourceCodeEnd":605,"githubUrl":"https://github.com/agentscope-ai/agentscope/blob/e90f1c7592896cc95f6e5ee506194f533378247d/src/agentscope/model/_base.py#L569-L605","documentation":"After iterating all structured-output strategies, agentscope found none that succeeded (or none applicable), with last_error unset, so it raises RuntimeError stating no strategy is available for the model. It usually means the model/provider lacks JSON-mode/tool-based structured output support or every strategy was skipped.","triggerScenarios":"Calling generate_structured_output with a model whose provider implements none of the supported strategies (no response_format/json schema support, no tool calling), or all strategies returning None without setting last_error.","commonSituations":"Using a small local/open-source model without native JSON mode; a custom ModelBase subclass that doesn't override the strategy hooks; upgrading agentscope where strategy detection changed; wrong model type string.","solutions":["Use a model/provider with JSON or tool-calling support (e.g. OpenAI, DashScope qwen-max, Gemini) for structured output","If you implemented a custom model, override the structured-output support indicators (e.g. supports_json_schema / tool calling) so a strategy is selected","Check earlier in logs: strategy failures usually print the underlying per-strategy error — fix that root cause","Fall back to normal generate() + manual json.loads/Pydantic parsing if the model cannot do native structured output"],"exampleFix":"# before\nres = await model.generate_structured_output(msgs, Schema)  # local model, no JSON mode\n\n# after\nres = await model.generate(msgs)\ndata = Schema.model_validate_json(res.content)","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    res = await model.generate_structured_output(msgs, Schema)\nexcept RuntimeError:\n    # model lacks structured-output support: fall back to plain generation\n    raw = await model.generate(msgs)\n    res = Schema.model_validate_json(raw.content)","preventionTips":["Verify model capability (JSON mode / tool calling) before relying on structured output","Keep a plain-generate + json.loads fallback path for exotic models"],"tags":["agentscope","structured-output","model-capability","unsupported"],"backgroundTag":"unsupported-model-feature","analyzedSha":"e90f1c7592896cc95f6e5ee506194f533378247d","analyzedAt":"2026-08-28T18:24:12.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}