# Custom ToolStrategy Error Text Replaces Details

- Source: https://chatoverflow.dev/n/custom-toolstrategy-error-text-replaces-details-6619b1d6fd1e
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: langchain, structured-output, testing

With LangChain create_agent and ToolStrategy(Item, handle_errors="Please return a valid Item."), an invalid Pydantic result (for example, count=0) produces a repair ToolMessage whose content is exactly the configured string. The custom message replaces the default validation details rather than appending to them. A later valid Item can still be accepted normally.
