{"record":{"id":"3641caff192e15fb","repo":"microsoft/autogen","slug":"no-taskresult-or-response-was-processed","errorCode":null,"errorMessage":"No TaskResult or Response was processed.","messagePattern":"No TaskResult or Response was processed\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-agentchat/src/autogen_agentchat/ui/_console.py","lineNumber":202,"sourceCode":"                    streaming_chunks.clear()\n                    # Chunked messages are already printed, so we just print a newline.\n                    await aprint(\"\", end=\"\\n\", flush=True)\n                elif isinstance(message, MultiModalMessage):\n                    await aprint(message.to_text(iterm=render_image_iterm), end=\"\\n\", flush=True)\n                else:\n                    await aprint(message.to_text(), end=\"\\n\", flush=True)\n                if message.models_usage:\n                    if output_stats:\n                        await aprint(\n                            f\"[Prompt tokens: {message.models_usage.prompt_tokens}, Completion tokens: {message.models_usage.completion_tokens}]\",\n                            end=\"\\n\",\n                            flush=True,\n                        )\n                    total_usage.completion_tokens += message.models_usage.completion_tokens\n                    total_usage.prompt_tokens += message.models_usage.prompt_tokens\n\n    if last_processed is None:\n        raise ValueError(\"No TaskResult or Response was processed.\")\n\n    return last_processed\n","sourceCodeStart":184,"sourceCodeEnd":205,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-agentchat/src/autogen_agentchat/ui/_console.py#L184-L205","documentation":"The console UI helper raises ValueError when a stream completes without any TaskResult or Response object being processed — the loop iterated only over events/other message types (or nothing at all). This indicates the run ended abnormally early or the stream source produced no terminal result.","triggerScenarios":"Calling the console(...) helper over a run_stream that yields only BaseAgentEvent items or nothing before finishing; a team whose stream was cancelled or errored such that the final TaskResult never arrived.","commonSituations":"Consuming console output of a team run that raised internally, was cancelled via CancellationToken, or a custom task runner that yields messages but never a TaskResult.","solutions":["Ensure the underlying run_stream always yields a final TaskResult (use the built-in team/agent run_stream implementations).","If the run was cancelled or errored, handle that path separately instead of relying on console() to return a value.","For custom task runners, yield TaskResult(messages=[...]) as the last item of the stream."],"exampleFix":"# before\nasync for _ in team.run_stream(task=\"x\"):  # if cancelled, no TaskResult\n    ...\nresult = await console(run_stream)  # ValueError\n\n# after\nstream = team.run_stream(task=\"x\")\nresult = await console(stream)  # rely on built-in teams which always emit TaskResult; catch cancellation upstream","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    result = await console(stream, output_stats=True)\nexcept ValueError as e:\n    if \"No TaskResult\" in str(e):\n        # stream ended without a TaskResult: cancelled or errored run\n        raise RuntimeError(\"Run produced no TaskResult; inspect cancellation/errors upstream\") from e\n    raise","preventionTips":["Ensure the consumed run_stream is a built-in team/agent stream that always ends with TaskResult.","Handle cancellation tokens and internal exceptions before wrapping a stream with console()."],"tags":["autogen","console","ui","task-result","streaming"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}