diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs index 3420c56512..e6c94347a1 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs @@ -416,7 +416,8 @@ internal static class BuiltInFunctions if (metadata.RuntimeStatus is OrchestrationRuntimeStatus.Failed) { - throw new InvalidOperationException($"Workflow orchestration '{instanceId}' failed: {metadata.ReadOutputAs()}"); + string errorMessage = metadata.FailureDetails?.ErrorMessage ?? "Unknown error"; + throw new InvalidOperationException($"Workflow orchestration '{instanceId}' failed: {errorMessage}"); } if (metadata.RuntimeStatus is not OrchestrationRuntimeStatus.Completed)