{"record":{"id":"429ece1fbe18afe0","repo":"HKUDS/Vibe-Trading","slug":"anthropic-provider-requires-langchain-anthropic-i","errorCode":null,"errorMessage":"Anthropic provider requires langchain-anthropic. Install the optional extra: pip install \"vibe-trading-ai[anthropic]\" (or pip install langchain-anthropic).","messagePattern":"Anthropic provider requires langchain-anthropic\\. Install the optional extra: pip install \"vibe-trading-ai\\[anthropic\\]\" \\(or pip install langchain-anthropic\\)\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"agent/src/providers/llm.py","lineNumber":1075,"sourceCode":"    temperature: float,\n    callbacks: Any = None,\n    effort: str = \"\",\n) -> Any:\n    \"\"\"Build the native Anthropic Messages API adapter.\n\n    Uses a temperature-safe subclass so models that deprecate the `temperature`\n    field (e.g. claude-opus-5 / claude-sonnet-5) work transparently while models\n    that still accept it keep the configured deterministic value.\n\n    `effort` is the configured LANGCHAIN_REASONING_EFFORT, forwarded only to\n    models that accept it (see `_anthropic_supports_effort`); an empty string\n    means unset.\n    \"\"\"\n    try:\n        module = import_module(\"langchain_anthropic\")\n        chat_anthropic = getattr(module, \"ChatAnthropic\")\n    except Exception as exc:  # noqa: BLE001 - dependency error with install hint\n        raise RuntimeError(\n            \"Anthropic provider requires langchain-anthropic. Install the optional \"\n            'extra: pip install \"vibe-trading-ai[anthropic]\" (or pip install langchain-anthropic).'\n        ) from exc\n\n    safe_anthropic = _make_temperature_safe_anthropic(chat_anthropic)\n    use_effort = (\n        bool(effort)\n        and _anthropic_supports_effort(model)\n        and _adapter_accepts_effort(chat_anthropic)\n    )\n    # Effort makes langchain-anthropic enable adaptive thinking, and the API\n    # then rejects any temperature other than 1:\n    #   `temperature` may only be set to 1 when thinking is enabled or in\n    #   adaptive mode\n    # The platform's default is 0.0, so temperature is omitted entirely\n    # whenever effort is in play. The temperature-safe wrapper above does not\n    # cover this: it handles models that reject `temperature` outright, not\n    # this thinking-conditional variant.","sourceCodeStart":1057,"sourceCodeEnd":1093,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/providers/llm.py#L1057-L1093","documentation":"build_llm was configured to use the Anthropic provider, but the langchain_anthropic package cannot be imported. The library wraps the ImportError with an install hint pointing at the optional extra vibe-trading-ai[anthropic].","triggerScenarios":"Setting LANGCHAIN_PROVIDER=anthropic (or an Anthropic model name) without having installed langchain-anthropic; a broken/partial install where the package exists but raises on import (missing transitive deps).","commonSituations":"Fresh environments where only core dependencies were installed; upgrading broke a transitive dependency; running in a slim Docker image or CI cache that skipped extras.","solutions":["Install the extra: pip install \"vibe-trading-ai[anthropic]\"","Or install directly: pip install langchain-anthropic","Verify import works: python -c \"import langchain_anthropic\"; if it fails, fix the underlying ImportError shown in the chain"],"exampleFix":"# before\npip install vibe-trading-ai\n\n# after\npip install \"vibe-trading-ai[anthropic]\"","handlingStrategy":"validation","validationCode":"try:\n    import langchain_anthropic  # noqa: F401\nexcept ImportError:\n    raise SystemExit('Install first: pip install \"vibe-trading-ai[anthropic]\"')","typeGuard":null,"tryCatchPattern":"try:\n    llm = build_llm()\nexcept RuntimeError as e:\n    if 'langchain-anthropic' in str(e):\n        subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'langchain-anthropic'])\n        llm = build_llm()","preventionTips":["Declare extras in requirements/lockfile per provider you enable","Add a startup dependency check that imports each provider package"],"tags":["anthropic","missing-dependency","pip","llm-provider"],"backgroundTag":"missing-optional-dependency","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}