{"record":{"id":"420c017939a4f23e","repo":"langchain-ai/langchain","slug":"tool-function-already-has-a-strict-key-with-valu","errorCode":null,"errorMessage":"Tool/function already has a 'strict' key with value {oai_function['strict']} which is different from the explicit `strict` arg received {strict=}.","messagePattern":"Tool/function already has a 'strict' key with value (.+?) which is different from the explicit `strict` arg received (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/core/langchain_core/utils/function_calling.py","lineNumber":477,"sourceCode":"                \"function name.\"\n            )\n            raise ValueError(msg)\n        msg = (\n            f\"Unsupported function\\n\\n{function}\\n\\nFunctions must be passed in\"\n            \" as Dict, pydantic.BaseModel, or Callable. If they're a dict they must\"\n            \" either be in OpenAI function format or valid JSON schema with top-level\"\n            \" 'title' key.\"\n        )\n        raise ValueError(msg)\n\n    if strict is not None:\n        if \"strict\" in oai_function and oai_function[\"strict\"] != strict:\n            msg = (\n                f\"Tool/function already has a 'strict' key with value \"\n                f\"{oai_function['strict']} which is different from the explicit \"\n                f\"`strict` arg received {strict=}.\"\n            )\n            raise ValueError(msg)\n        oai_function[\"strict\"] = strict\n        if strict:\n            # All fields must be `required`\n            parameters = oai_function.get(\"parameters\")\n            if isinstance(parameters, dict):\n                fields = parameters.get(\"properties\")\n                if isinstance(fields, dict) and fields:\n                    parameters = dict(parameters)\n                    parameters[\"required\"] = list(fields.keys())\n                    oai_function[\"parameters\"] = parameters\n\n            # As of 08/06/24, OpenAI requires that additionalProperties be supplied and\n            # set to False if strict is True.\n            # All properties layer needs 'additionalProperties=False'\n            oai_function[\"parameters\"] = _recursive_set_additional_properties_false(\n                oai_function[\"parameters\"]\n            )\n    return oai_function","sourceCodeStart":459,"sourceCodeEnd":495,"githubUrl":"https://github.com/langchain-ai/langchain/blob/e32fa9a52eab3b61ad7a45399bfde59b3e580fc4/libs/core/langchain_core/utils/function_calling.py#L459-L495","documentation":"Error \"Tool/function already has a 'strict' key with value {oai_function['strict']} which is different from the explicit `strict` arg received {strict=}.\" thrown in langchain-ai/langchain.","triggerScenarios":"Raised when the function dict already contains a 'strict' key and an explicit strict argument with a conflicting value is also passed.","commonSituations":"See trigger scenarios.","solutions":["Set 'strict' in exactly one place: either inside the function dict or via the explicit strict argument, not both with different values.","Make the two values agree, or drop the embedded 'strict' key and use the strict= keyword."],"exampleFix":"convert_to_openai_tool(schema, strict=True)  # remove 'strict' from schema dict","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-15T22:17:37.221Z"}