{"record":{"id":"b1fd4df1e2eff579","repo":"microsoft/semantic-kernel","slug":"run-failed-with-status-response-status-for-ag","errorCode":null,"errorMessage":"Run failed with status: `{response.Status}` for agent `{agent.Name}` with error: {response.Error.Message} or incomplete details: {response.IncompleteStatusDetails.Reason}","messagePattern":"Run failed with status: `(.+?)` for agent `(.+?)` with error: (.+?) or incomplete details: (.+?)","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Agents/OpenAI/Internal/ResponseThreadActions.cs","lineNumber":316,"sourceCode":"            yield return streamingFunctionResultMessage;\n        }\n    }\n\n    private static ChatHistory GetChatHistory(AgentThread agentThread)\n    {\n        if (agentThread is ChatHistoryAgentThread chatHistoryAgentThread)\n        {\n            return chatHistoryAgentThread.ChatHistory;\n        }\n\n        throw new InvalidOperationException(\"The agent thread is not a ChatHistoryAgentThread.\");\n    }\n\n    private static void ThrowIfIncompleteOrFailed(OpenAIResponseAgent agent, ResponseResult response)\n    {\n        if (response.Status is ResponseStatus.Incomplete or ResponseStatus.Failed)\n        {\n            throw new KernelException(\n                $\"Run failed with status: `{response.Status}` for agent `{agent.Name}` with error: {response.Error.Message} or incomplete details: {response.IncompleteStatusDetails.Reason}\");\n        }\n    }\n\n    /// <summary>\n    /// Processes a function result and returns a string representation.\n    /// The OpenAI Responses API does not support multimodal tool results, so ImageContent returns an error message.\n    /// </summary>\n    internal static string GetFunctionResultAsString(object? result)\n    {\n        var processed = FunctionCallsProcessor.ProcessFunctionResult(result ?? string.Empty);\n\n        if (processed is ImageContent)\n        {\n            return FunctionCallsProcessor.ImageContentNotSupportedErrorMessage;\n        }\n\n        return (string?)processed ?? string.Empty;","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Agents/OpenAI/Internal/ResponseThreadActions.cs#L298-L334","documentation":"ResponseThreadActions.ThrowIfIncompleteOrFailed fires when an OpenAI Responses-API result has a status of Incomplete or Failed. It throws a KernelException including the agent name, the error message, and the incomplete-status reason.","triggerScenarios":"A Responses-API call returns Incomplete (e.g., max_output_tokens reached, content filter, incomplete reason) or Failed (service/model error) for the agent invocation.","commonSituations":"Output token limit too low triggering Incomplete; content-policy block; model/endpoint error; malformed request causing failure.","solutions":["Inspect response.Status, response.Error.Message, and response.IncompleteStatusDetails.Reason in the exception.","Increase max_output_tokens (or prompt execution settings) if the cause is Incomplete due to length.","Adjust prompt/content if a content filter triggered.","Retry transient Failed responses with backoff."],"exampleFix":"// before\nvar result = await agent.InvokeAsync(thread);\n// after\ntry {\n    var result = await agent.InvokeAsync(thread);\n}\ncatch (KernelException ex) when (ex.Message.Contains(\"Run failed with status\")) {\n    logger.LogError(ex, \"Responses run failed/incomplete\");\n    // raise max_output_tokens or adjust prompt, then retry\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { var result = await agent.InvokeAsync(thread); }\ncatch (KernelException ex) when (ex.Message.Contains(\"Run failed with status\")) {\n    logger.LogError(ex, \"Responses run failed/incomplete; raise max_output_tokens or adjust prompt\");\n}","preventionTips":["Set max_output_tokens high enough to avoid Incomplete-by-length.","Review prompts for content that may trip filters.","Log Status/Error/IncompleteStatusDetails from the exception."],"tags":["openai","responses-api","model-error","content-filter"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}