ComposioHQ/composio · error · ValueError

Unrecognized key(s) in object: {', '.join(repr(key) for key

Error message

Unrecognized key(s) in object: {', '.join(repr(key) for key in unrecognized)}

What it means

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.

Source

Thrown at python/composio/utils/schema_converter.py:917

        unrecognized = []
        for key, item in value.items():
            matched = False
            for regex, validator in policy.patterns:
                if regex.search(key):
                    matched = True
                    validator.validate(item)

            if matched or key in policy.declared:
                continue

            if policy.rejects_unmatched:
                unrecognized.append(key)
            elif policy.additional is not None:
                policy.additional.validate(item)

        if unrecognized:
            raise ValueError(
                f"Unrecognized key(s) in object: {', '.join(repr(key) for key in unrecognized)}"
            )

        return value

    @model_validator(mode="after")
    def _materialize_dynamic_defaults(self):
        policy: t.Optional[_ObjectPolicy] = getattr(
            type(self), "__composio_object_policy__", None
        )
        if policy is None or policy.is_trivial:
            return self

        extra = self.__pydantic_extra__
        if not extra:
            return self

        for key, value in list(extra.items()):

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Compare your argument keys against the tool's current schema properties and remove/fix the unrecognized ones
  2. Re-fetch the tool schema if it may have changed server-side (version drift)
  3. Normalize key casing (camelCase vs snake_case) to match the schema exactly
  4. If you control the schema and want extra keys tolerated, set additionalProperties or patternProperties appropriately instead of false-rejection

Example fix

# before
client.execute_action(action="SEARCH", params={"query": "x", "quer": "y"})
# after
client.execute_action(action="SEARCH", params={"query": "y"})
Defensive patterns

Strategy: validation

Validate before calling

def only_known_keys(args, schema):
    allowed = set(schema.get("properties", {}))
    import re
    for pat in (schema.get("patternProperties") or {}):
        rx = re.compile(pat)
        allowed |= {k for k in args if rx.match(k)}
    unknown = set(args) - allowed
    return None if not unknown else unknown

Try / catch

try:
    policy.validate(args)
except ValueError as e:
    if "Unrecognized key" in str(e):
        args = {k: v for k, v in args.items() if k in allowed}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28). Data as JSON: /api/errors/dfbee0d29a739b9e. Report an issue: GitHub.