{"record":{"id":"4428c9f6dd6e15ff","repo":"langchain-ai/langchain","slug":"expected-package-version-to-be-lte-version","errorCode":null,"errorMessage":"Expected {package} version to be <= {lte_version}. Received {imported_version}.","messagePattern":"Expected (.+?) version to be <= (.+?)\\. Received (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/core/langchain_core/utils/utils.py","lineNumber":178,"sourceCode":"        gte_version: The version must be greater than or equal to this.\n\n\n    Raises:\n        ValueError: If the package version does not meet the requirements.\n    \"\"\"\n    imported_version = parse(version(package))\n    if lt_version is not None and imported_version >= parse(lt_version):\n        msg = (\n            f\"Expected {package} version to be < {lt_version}. Received \"\n            f\"{imported_version}.\"\n        )\n        raise ValueError(msg)\n    if lte_version is not None and imported_version > parse(lte_version):\n        msg = (\n            f\"Expected {package} version to be <= {lte_version}. Received \"\n            f\"{imported_version}.\"\n        )\n        raise ValueError(msg)\n    if gt_version is not None and imported_version <= parse(gt_version):\n        msg = (\n            f\"Expected {package} version to be > {gt_version}. Received \"\n            f\"{imported_version}.\"\n        )\n        raise ValueError(msg)\n    if gte_version is not None and imported_version < parse(gte_version):\n        msg = (\n            f\"Expected {package} version to be >= {gte_version}. Received \"\n            f\"{imported_version}.\"\n        )\n        raise ValueError(msg)\n\n\ndef get_pydantic_field_names(pydantic_cls: Any) -> set[str]:\n    \"\"\"Get field names, including aliases, for a pydantic class.\n\n    Args:","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/langchain-ai/langchain/blob/e32fa9a52eab3b61ad7a45399bfde59b3e580fc4/libs/core/langchain_core/utils/utils.py#L160-L196","documentation":"Raised by `check_package_version` in `langchain_core.utils.utils` for the inclusive upper bound: the installed `package` version is strictly greater than `lte_version`. This is the same ceiling guard as the `<` variant, but the boundary version itself is allowed (e.g. `lte_version=\"1.2.3\"` accepts 1.2.3, rejects 1.2.4+). It fails at import/first use of the guarded integration.","triggerScenarios":"`check_package_version(pkg, lte_version=X)` runs with an installed version above X — typically after upgrading the dependency (e.g. `openai` SDK or `pydantic`) past the last version the installed LangChain integration was validated against.","commonSituations":"Fresh environments installing newest dependency versions alongside older pinned LangChain releases; Dependabot-style automated upgrades; local development on the dependency's new major while the integration expects the previous one.","solutions":["Pin the dependency at or below the boundary from the message (`pip install \"pkg<=X\"`), or better, exact-pin to the lockfile version.","Upgrade the LangChain integration package to a release compatible with the newer dependency.","In monorepos, run `uv sync` against the committed lockfile instead of resolving fresh."],"exampleFix":"# before\n# ValueError: Expected openai version to be <= 1.40.0. Received 1.55.1.\n\n# after (terminal)\n# pip install \"openai<=1.40.0\"\n# or: pip install -U langchain-openai  (integration supporting newer openai)","handlingStrategy":"validation","validationCode":"from packaging.version import Version\n\ndef version_lte(pkg: str, ceiling: str) -> bool:\n    return Version(importlib.metadata.version(pkg)) <= Version(ceiling)\n\nif not version_lte(\"openai\", \"1.40.0\"):\n    raise RuntimeError(\"openai too new for this integration; pin or upgrade integration\")","typeGuard":null,"tryCatchPattern":"try:\n    check_package_version(pkg, lte_version=ceiling)\nexcept ValueError as e:\n    raise RuntimeError(f\"dependency ceiling violated: {e}\") from e","preventionTips":["Commit and install lockfiles so transitive upgrades cannot pass validated ceilings.","Upgrade integration and dependency together in one PR.","Assert dependency versions during application startup."],"tags":["versioning","dependencies","environment"],"backgroundTag":null,"analyzedSha":"e32fa9a52eab3b61ad7a45399bfde59b3e580fc4","analyzedAt":"2026-08-14T18:42:09.092Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}