microsoft/semantic-kernel · error · RuntimeError

The invocation did not produce a result.

Error message

The invocation did not produce a result.

What it means

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.

Source

Thrown at python/semantic_kernel/agents/orchestration/orchestration_base.py:66

        invocation will not be aborted.

        Args:
            timeout (int | None): The timeout (seconds) for getting the result. If None, wait indefinitely.

        Returns:
            TOut: The result of the invocation.
        """
        if timeout is not None:
            await asyncio.wait_for(self.event.wait(), timeout=timeout)
        else:
            await self.event.wait()

        if self.value is None:
            if self.cancellation_token.is_cancelled():
                raise RuntimeError("The invocation was canceled before it could complete.")
            if self.exception is not None:
                raise self.exception
            raise RuntimeError("The invocation did not produce a result.")
        return self.value

    def cancel(self) -> None:
        """Cancel the invocation.

        This method will cancel the invocation.
        Actors that have received messages will continue to process them, but no new messages will be processed.
        """
        if self.cancellation_token.is_cancelled():
            raise RuntimeError("The invocation has already been canceled.")
        if self.event.is_set():
            raise RuntimeError("The invocation has already been completed.")

        self.cancellation_token.cancel()
        self.event.set()


@experimental

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Ensure your output_transform always returns a non-None value for every code path.
  2. If you pass a custom result_callback, always set orchestration_result.value before orchestration_result.event.set().
  3. Report it as a library bug if it occurs with stock orchestrations and a well-formed output_transform.

Example fix

// before
def out_transform(result):
    if result:
        return result[-1].content
    # missing return -> None -> get() raises

orch = MyOrchestration(members, output_transform=out_transform)

// after
def out_transform(result):
    return result[-1].content if result else ""
Defensive patterns

Strategy: validation

Validate before calling

# Ensure output_transform never returns None
def output_transform(result):
    return result[-1].content if result else ""  # always a value

orch = MyOrchestration(members, output_transform=output_transform)

Type guard

def transform_is_total(fn, sample) -> bool:
    out = fn(sample)
    return out is not None

Try / catch

try:
    value = await result.get()
except RuntimeError as e:
    if "did not produce a result" in str(e):
        log.error("output_transform likely returned None")
    raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/cbe2fa19d860a9a1. Report an issue: GitHub.