{"record":{"id":"cbe2fa19d860a9a1","repo":"microsoft/semantic-kernel","slug":"the-invocation-did-not-produce-a-result","errorCode":null,"errorMessage":"The invocation did not produce a result.","messagePattern":"The invocation did not produce a result\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/agents/orchestration/orchestration_base.py","lineNumber":66,"sourceCode":"        invocation will not be aborted.\n\n        Args:\n            timeout (int | None): The timeout (seconds) for getting the result. If None, wait indefinitely.\n\n        Returns:\n            TOut: The result of the invocation.\n        \"\"\"\n        if timeout is not None:\n            await asyncio.wait_for(self.event.wait(), timeout=timeout)\n        else:\n            await self.event.wait()\n\n        if self.value is None:\n            if self.cancellation_token.is_cancelled():\n                raise RuntimeError(\"The invocation was canceled before it could complete.\")\n            if self.exception is not None:\n                raise self.exception\n            raise RuntimeError(\"The invocation did not produce a result.\")\n        return self.value\n\n    def cancel(self) -> None:\n        \"\"\"Cancel the invocation.\n\n        This method will cancel the invocation.\n        Actors that have received messages will continue to process them, but no new messages will be processed.\n        \"\"\"\n        if self.cancellation_token.is_cancelled():\n            raise RuntimeError(\"The invocation has already been canceled.\")\n        if self.event.is_set():\n            raise RuntimeError(\"The invocation has already been completed.\")\n\n        self.cancellation_token.cancel()\n        self.event.set()\n\n\n@experimental","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/agents/orchestration/orchestration_base.py#L48-L84","documentation":"OrchestrationResult.get() returns when the internal event is set, meaning the run signaled completion. If at that point value is None, the token is not canceled, and there is no stored exception, the result is in an inconsistent state and get() raises. This usually indicates the output_transform returned None or an internal code path set the event without a value.","triggerScenarios":"The orchestration's result_callback set orchestration_result.event without assigning a non-None value — typically because the output_transform returned None — and get() is then awaited.","commonSituations":"An output_transform whose function returns None (missing return statement, or returns None on some branch). A bug in a custom orchestration subclass that sets the event manually. The orchestration completing abnormally without recording an exception.","solutions":["Ensure your output_transform always returns a non-None value for every code path.","If you pass a custom result_callback, always set orchestration_result.value before orchestration_result.event.set().","Report it as a library bug if it occurs with stock orchestrations and a well-formed output_transform."],"exampleFix":"// before\ndef out_transform(result):\n    if result:\n        return result[-1].content\n    # missing return -> None -> get() raises\n\norch = MyOrchestration(members, output_transform=out_transform)\n\n// after\ndef out_transform(result):\n    return result[-1].content if result else \"\"","handlingStrategy":"validation","validationCode":"# Ensure output_transform never returns None\ndef output_transform(result):\n    return result[-1].content if result else \"\"  # always a value\n\norch = MyOrchestration(members, output_transform=output_transform)","typeGuard":"def transform_is_total(fn, sample) -> bool:\n    out = fn(sample)\n    return out is not None","tryCatchPattern":"try:\n    value = await result.get()\nexcept RuntimeError as e:\n    if \"did not produce a result\" in str(e):\n        log.error(\"output_transform likely returned None\")\n    raise","preventionTips":["Make output_transform total: return a default on every branch.","If you set the result event manually, always assign value first.","Unit-test the transform with empty and non-empty inputs."],"tags":["semantic-kernel","orchestration","result","output-transform","state"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}