Change8
Error2 reports

Fix FakeListChatModelError

in LangChain

Solution

The "FakeListChatModelError" often arises in testing when the mock chat model's output is unexpectedly nested within a list (e.g., `[[]]`) instead of directly being a list of messages or an empty list (`[]`). To fix this, ensure your `FakeListChatModel` or similar mock returns the expected structure; usually, this means flattening nested lists or returning `[]` explicitly when no messages should be streamed. Verify the return value from the mock chat model aligns with the expected data structure in the test case.

Timeline

First reported:Apr 18, 2026
Last reported:Apr 18, 2026

Need More Help?

View the full changelog and migration guides for LangChain

View LangChain Changelog
Fix FakeListChatModelError in LangChain | Change8