{"record":{"id":"dfbee0d29a739b9e","repo":"ComposioHQ/composio","slug":"unrecognized-key-s-in-object-join-repr-key","errorCode":null,"errorMessage":"Unrecognized key(s) in object: {', '.join(repr(key) for key in unrecognized)}","messagePattern":"Unrecognized key\\(s\\) in object: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/composio/utils/schema_converter.py","lineNumber":917,"sourceCode":"\n        unrecognized = []\n        for key, item in value.items():\n            matched = False\n            for regex, validator in policy.patterns:\n                if regex.search(key):\n                    matched = True\n                    validator.validate(item)\n\n            if matched or key in policy.declared:\n                continue\n\n            if policy.rejects_unmatched:\n                unrecognized.append(key)\n            elif policy.additional is not None:\n                policy.additional.validate(item)\n\n        if unrecognized:\n            raise ValueError(\n                f\"Unrecognized key(s) in object: {', '.join(repr(key) for key in unrecognized)}\"\n            )\n\n        return value\n\n    @model_validator(mode=\"after\")\n    def _materialize_dynamic_defaults(self):\n        policy: t.Optional[_ObjectPolicy] = getattr(\n            type(self), \"__composio_object_policy__\", None\n        )\n        if policy is None or policy.is_trivial:\n            return self\n\n        extra = self.__pydantic_extra__\n        if not extra:\n            return self\n\n        for key, value in list(extra.items()):","sourceCodeStart":899,"sourceCodeEnd":935,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/python/composio/utils/schema_converter.py#L899-L935","documentation":"Raised by the object-policy model validator when the input dict contains keys that are neither declared properties nor matched by patternProperties, while the policy rejects unmatched keys (additionalProperties: false and no applicable additional policy). The message lists the offending keys.","triggerScenarios":"Validating arguments like {\"query\": \"x\", \"quer\": \"y\"} against a schema whose properties only declare query and rejects_unmatched is set — e.g. an LLM typo, hallucinated parameter, or stale field name after the tool schema changed.","commonSituations":"LLM tool calls inventing extra parameters; schemas that recently dropped a field but cached callers still send it; snake_case/camelCase mismatches producing unknown keys; merging default dicts into arguments that include deprecated keys.","solutions":["Compare your argument keys against the tool's current schema properties and remove/fix the unrecognized ones","Re-fetch the tool schema if it may have changed server-side (version drift)","Normalize key casing (camelCase vs snake_case) to match the schema exactly","If you control the schema and want extra keys tolerated, set additionalProperties or patternProperties appropriately instead of false-rejection"],"exampleFix":"# before\nclient.execute_action(action=\"SEARCH\", params={\"query\": \"x\", \"quer\": \"y\"})\n# after\nclient.execute_action(action=\"SEARCH\", params={\"query\": \"y\"})","handlingStrategy":"validation","validationCode":"def only_known_keys(args, schema):\n    allowed = set(schema.get(\"properties\", {}))\n    import re\n    for pat in (schema.get(\"patternProperties\") or {}):\n        rx = re.compile(pat)\n        allowed |= {k for k in args if rx.match(k)}\n    unknown = set(args) - allowed\n    return None if not unknown else unknown","typeGuard":null,"tryCatchPattern":"try:\n    policy.validate(args)\nexcept ValueError as e:\n    if \"Unrecognized key\" in str(e):\n        args = {k: v for k, v in args.items() if k in allowed}","preventionTips":["Filter argument dicts against the schema's properties before sending","Re-fetch tool schemas after backend updates; cache with TTL","Normalize key casing to the schema's convention centrally"],"tags":["json-schema","validation","tool-arguments","additional-properties"],"backgroundTag":"schema-validation-failed","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}