{"record":{"id":"c273ebd2de9d9c56","repo":"langchain-ai/langchain","slug":"ref-paths-are-expected-to-be-uri-fragments-meanin","errorCode":null,"errorMessage":"ref paths are expected to be URI fragments, meaning they should start with #.","messagePattern":"ref paths are expected to be URI fragments, meaning they should start with #\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/core/langchain_core/utils/json_schema.py","lineNumber":35,"sourceCode":"\n    Args:\n        path: Reference path starting with `'#'` (e.g., `'#/definitions/MyType'`).\n        schema: The JSON schema dictionary to search in.\n\n    Returns:\n        A deep copy of the referenced object (dict or list).\n\n    Raises:\n        ValueError: If the path does not start with `'#'`.\n        KeyError: If the reference path is not found in the schema.\n    \"\"\"\n    components = path.split(\"/\")\n    if components[0] != \"#\":\n        msg = (\n            \"ref paths are expected to be URI fragments, meaning they should start \"\n            \"with #.\"\n        )\n        raise ValueError(msg)\n    out: list[Any] | dict[Any, Any] = schema\n    for component in components[1:]:\n        if component in out:\n            if isinstance(out, list):\n                msg = f\"Reference '{path}' not found.\"\n                raise KeyError(msg)\n            out = out[component]\n        elif component.isdigit():\n            index = int(component)\n            if (isinstance(out, list) and 0 <= index < len(out)) or (\n                isinstance(out, dict) and index in out\n            ):\n                out = out[index]\n            else:\n                msg = f\"Reference '{path}' not found.\"\n                raise KeyError(msg)\n        else:\n            msg = f\"Reference '{path}' not found.\"","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/langchain-ai/langchain/blob/e32fa9a52eab3b61ad7a45399bfde59b3e580fc4/libs/core/langchain_core/utils/json_schema.py#L17-L53","documentation":"Error \"ref paths are expected to be URI fragments, meaning they should start with #.\" thrown in langchain-ai/langchain.","triggerScenarios":"Raised when dereferencing a JSON Schema $ref whose value is not a URI fragment starting with '#' (e.g. an external URL reference).","commonSituations":"See trigger scenarios.","solutions":["Use URI fragment references that start with '#', e.g. '#/definitions/MyModel'.","If you need external file references, resolve them before dereferencing; only local fragments are supported."],"exampleFix":"{'$ref': '#/definitions/MyModel'}","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e32fa9a52eab3b61ad7a45399bfde59b3e580fc4","analyzedAt":"2026-08-14T18:42:09.092Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}