ComposioHQ/composio · error · ValueError

{error.message}

Error message

{error.message}

What it means

Raised by the object-policy validator in schema_converter.py when a value fails jsonschema validation against the tool's input schema. The message is the underlying jsonschema error's message (e.g. "'x' is a required property", "32 is not of type 'string'"), re-raised as ValueError from validate().

Source

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

    if _is_unsatisfiable_schema(schema):
        return True
    if isinstance(schema, list):
        return any(_contains_unsatisfiable_schema(item) for item in schema)
    if isinstance(schema, dict):
        return any(_contains_unsatisfiable_schema(value) for value in schema.values())
    return False


class _DynamicKeyValidator(t.NamedTuple):
    """Exact JSON Schema validation with optional default materialization."""

    validator: Validator
    materializer: t.Optional[TypeAdapter]

    def validate(self, value: t.Any) -> None:
        error = next(self.validator.iter_errors(value), None)
        if error is not None:
            raise ValueError(error.message)

    def materialize(self, value: t.Any) -> t.Any:
        if self.materializer is None:
            return value
        try:
            return _materialized_value_to_python(
                self.materializer.validate_python(_materialized_value_to_python(value))
            )
        except (TypeError, ValueError):
            # JSON Schema alone decides acceptance. Pydantic is only retained
            # for the existing default-materialization behavior, and an
            # incomplete Pydantic representation must not reject valid input.
            logger.debug("Could not materialize dynamic-key defaults; preserving input")
            return value


def _materialized_value_to_python(value: t.Any) -> t.Any:
    """Convert a previous materializer result back into validation input."""

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Match your arguments exactly to the tool's current input schema (re-fetch it and check `required` and property types)
  2. Coerce types before validating: ensure strings stay strings, enums use exact allowed values
  3. If extra keys are rejected, strip unrecognized keys from arguments before calling the tool
  4. Pin/refresh the generated client so the local schema matches the backend's

Example fix

# before
result = tool.run({"query": 32})
# after
result = tool.run({"query": "32"})
Defensive patterns

Strategy: try-catch

Validate before calling

from jsonschema import Draft202012Validator
v = Draft202012Validator(schema)
errors = list(v.iter_errors(args))
if errors:
    raise ValueError(errors[0].message)

Try / catch

try:
    policy.validate(args)
except ValueError as e:
    log.warning("tool args failed schema: %s", e)
    args = repair_args(args, schema)

Prevention

When it happens

Trigger: Calling validate(value) directly, or letting _validate_object_policy run during model validation, with arguments that violate the schema: missing required properties, wrong types, failing enum/pattern constraints, additional properties when additionalProperties is false.

Common situations: LLM-produced tool arguments that omit required fields or hallucinate extra keys; passing Python-native values (ints where schema expects strings); strict schemas with rejects_unmatched enabled; mismatches between the schema version the client cached and the backend's current schema.

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/d078f032069781a6. Report an issue: GitHub.