Skip to content

fix: validate Agent messages input type with actionable error#11833

Draft
ArzelaAscoIi wants to merge 1 commit into
mainfrom
feature/pip-491-pipeline-error-typeerror-liststr-in-agent-component
Draft

fix: validate Agent messages input type with actionable error#11833
ArzelaAscoIi wants to merge 1 commit into
mainfrom
feature/pip-491-pipeline-error-typeerror-liststr-in-agent-component

Conversation

@ArzelaAscoIi

Copy link
Copy Markdown
Member

Summary

  • Agent._initialize_fresh_execution now raises TypeError with a clear, actionable message when messages is not a list
  • Previously, passing a string (e.g. from a misrouted pipeline connection) produced the opaque can only concatenate list (not "str") to list error deep in the method
  • Added unit test covering the str input case

Test plan

  • hatch run test:unit test/components/agents/test_agent.py -k "test_run_messages_string_raises_type_error" passes

Fixes PIP-491

🤖 Generated with Claude Code

Raises TypeError with a clear message when messages is not a list,
instead of crashing with the opaque "can only concatenate list (not 'str')
to list" error when a string is wired to the Agent messages input.

Fixes PIP-491.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
haystack-docs Ignored Ignored Jun 30, 2026 12:20pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack/components/agents
  agent.py
Project Total  

This report was generated by python-coverage-comment-action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant