LangChain agent: {tool_name} is not a valid tool, try another one (long tool names)

An agent intermittently failed with "{toolname} is not a valid tool, try another one" — e.g. "retrievefromsomewhereelse is not a valid tool, try [retrievefromvectorstore]" — even though both tools were registered. Wrapping an agent as a tool of another agent also triggered it. The failures were rare and intermittent rather than consistent, which made them hard to reproduce on demand.

Shorten your tool names. The reporter's own fix: renaming long tool names like retrieve_from_somewhere_else to short ones like use_somewhere_else stopped the error entirely. The model was garbling or truncating long tool names when selecting tools, so the agent referenced a name that did not match any registered tool. Source: https://github.com/langchain-ai/langchain/issues/1559

Source: https://github.com/langchain-ai/langchain/issues/1559