langchain - 💡(How to fix) Fix langchain-ollama: Error with using local model `gwen3:8b` [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langchain-ai/langchain#35200Fetched 2026-04-08 00:27:18
View on GitHub
Comments
2
Participants
2
Timeline
8
Reactions
0
Author
Timeline (top)
labeled ×3commented ×2closed ×1issue_type_added ×1

Encountered this error although gwen3:8b has been pulled by ollama (and indicated in the error log too)

Error Message

pydantic_core._pydantic_core.ValidationError: 1 validation error for ChatOllama Value error, Model gwen3:8b not found in Ollama. Please pull the model (using ollama pull gwen3:8b) or specify a valid model name. Available local models: qwen3:8b, deepseek-v3.2:cloud, llama3:latest [type=value_error, input_value={'model': 'gwen3:8b', 'va... True, 'temperature': 0}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/value_error

Root Cause

Encountered this error although gwen3:8b has been pulled by ollama (and indicated in the error log too)

Fix Action

Fix / Workaround

  • This is a bug, not a usage question.
  • I added a clear and descriptive title that summarizes this issue.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
  • This is not related to the langchain-community package.
  • I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

Other Dependencies

aiohttp: 3.13.3 dataclasses-json: 0.6.7 httpx: 0.28.1 httpx-sse: 0.4.3 jsonpatch: 1.33 langgraph: 1.0.8 numpy: 2.4.2 ollama: 0.6.1 orjson: 3.11.7 packaging: 26.0 pydantic: 2.12.5 pydantic-settings: 2.12.0 PyYAML: 6.0.3 pyyaml: 6.0.3 requests: 2.32.5 requests-toolbelt: 1.0.0 SQLAlchemy: 2.0.46 sqlalchemy: 2.0.46 tenacity: 9.1.4 typing-extensions: 4.15.0 uuid-utils: 0.14.0 xxhash: 3.6.0 zstandard: 0.25.0

Code Example

from typing import List

from langchain.messages import AIMessage
from langchain.tools import tool
from langchain_ollama import ChatOllama

@tool
def validate_user(user_id: int, addresses: List[str]) -> bool:
    """Validate user using historical addresses.

    Args:
        user_id (int): the user ID.
        addresses (List[str]): Previous addresses as a list of strings.
    """
    return True

llm = ChatOllama(
    model="gwen3:8b",
    validate_model_on_init=True,
    temperature=0,
).bind_tools([validate_user])

result = llm.invoke(
    "Could you validate user 123? They previously lived at "
    "123 Fake St in Boston MA and 234 Pretend Boulevard in "
    "Houston TX."
)

if isinstance(result, AIMessage) and result.tool_calls:
    print(result.tool_calls)

---

pydantic_core._pydantic_core.ValidationError: 1 validation error for ChatOllama
  Value error, Model `gwen3:8b` not found in Ollama. Please pull the model (using `ollama pull gwen3:8b`) or specify a valid model name. Available local models: qwen3:8b, deepseek-v3.2:cloud, llama3:latest [type=value_error, input_value={'model': 'gwen3:8b', 'va... True, 'temperature': 0}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.12/v/value_error
RAW_BUFFERClick to expand / collapse

Checked other resources

  • This is a bug, not a usage question.
  • I added a clear and descriptive title that summarizes this issue.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
  • This is not related to the langchain-community package.
  • I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

Package (Required)

  • langchain
  • langchain-openai
  • langchain-anthropic
  • langchain-classic
  • langchain-core
  • langchain-model-profiles
  • langchain-tests
  • langchain-text-splitters
  • langchain-chroma
  • langchain-deepseek
  • langchain-exa
  • langchain-fireworks
  • langchain-groq
  • langchain-huggingface
  • langchain-mistralai
  • langchain-nomic
  • langchain-ollama
  • langchain-perplexity
  • langchain-qdrant
  • langchain-xai
  • Other / not sure / general

Related Issues / PRs

No response

Reproduction Steps / Example Code (Python)

from typing import List

from langchain.messages import AIMessage
from langchain.tools import tool
from langchain_ollama import ChatOllama

@tool
def validate_user(user_id: int, addresses: List[str]) -> bool:
    """Validate user using historical addresses.

    Args:
        user_id (int): the user ID.
        addresses (List[str]): Previous addresses as a list of strings.
    """
    return True

llm = ChatOllama(
    model="gwen3:8b",
    validate_model_on_init=True,
    temperature=0,
).bind_tools([validate_user])

result = llm.invoke(
    "Could you validate user 123? They previously lived at "
    "123 Fake St in Boston MA and 234 Pretend Boulevard in "
    "Houston TX."
)

if isinstance(result, AIMessage) and result.tool_calls:
    print(result.tool_calls)

Error Message and Stack Trace (if applicable)

pydantic_core._pydantic_core.ValidationError: 1 validation error for ChatOllama
  Value error, Model `gwen3:8b` not found in Ollama. Please pull the model (using `ollama pull gwen3:8b`) or specify a valid model name. Available local models: qwen3:8b, deepseek-v3.2:cloud, llama3:latest [type=value_error, input_value={'model': 'gwen3:8b', 'va... True, 'temperature': 0}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.12/v/value_error

Description

Encountered this error although gwen3:8b has been pulled by ollama (and indicated in the error log too)

System Info

System Information

OS: Linux OS Version: #91-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 18 14:14:30 UTC 2025 Python Version: 3.12.3 (main, Jan 22 2026, 20:57:42) [GCC 13.3.0]

Package Information

langchain_core: 1.2.11 langchain: 1.2.10 langchain_community: 0.4.1 langsmith: 0.7.1 langchain_classic: 1.0.1 langchain_ollama: 1.0.1 langchain_text_splitters: 1.1.0 langgraph_sdk: 0.3.5 langgraph_swarm: 0.1.0

Optional packages not installed

langserve

Other Dependencies

aiohttp: 3.13.3 dataclasses-json: 0.6.7 httpx: 0.28.1 httpx-sse: 0.4.3 jsonpatch: 1.33 langgraph: 1.0.8 numpy: 2.4.2 ollama: 0.6.1 orjson: 3.11.7 packaging: 26.0 pydantic: 2.12.5 pydantic-settings: 2.12.0 PyYAML: 6.0.3 pyyaml: 6.0.3 requests: 2.32.5 requests-toolbelt: 1.0.0 SQLAlchemy: 2.0.46 sqlalchemy: 2.0.46 tenacity: 9.1.4 typing-extensions: 4.15.0 uuid-utils: 0.14.0 xxhash: 3.6.0 zstandard: 0.25.0

extent analysis

Fix Plan

1. Verify Model Availability

Before invoking the ChatOllama instance, verify if the model is available locally.

import ollama

# Check if the model is available
if ollama.model_exists("gwen3:8b"):
    print("Model gwen3:8b is available.")
else:
    print("Model gwen3:8b is not available.")

2. Pull the Model (if not available)

If the model is not available, pull it using the ollama pull command.

ollama pull gwen3:8b

3. Update the Code to Use the Pulled Model

After pulling the model, update the code to use the pulled model.

llm = ChatOllama(
    model="gwen3:8b",  # Use the pulled model
    validate_model_on_init=True,
    temperature=0,
).bind_tools([validate_user])

4. Verify the Fix

Run the code again and verify that the error is resolved.

result = llm.invoke(
    "Could you validate user 123? They previously lived at "
    "123 Fake St in Boston MA and 234 Pretend Boulevard in "
    "Houston TX."
)

if isinstance(result, AIMessage) and result.tool_calls:
    print(result.tool_calls)

Extra Tips

  • Make sure to pull the model before using it in the code.
  • Verify the model availability before invoking the ChatOllama instance.
  • Use the pulled model in the code to avoid any issues.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING