FoundationAgents/OpenManus · error · ServerError

-32602

-32602

Error message

Invalid params

What it means

A JSON-RPC error (code -32602, InvalidParams) raised as ServerError(InvalidParamsError()) by the A2A agent executor when its request validation reports a problem. In the shipped example _validate_request() is a stub returning False, so in the current code this branch is effectively unreachable unless validation is added; it exists as the hook where parameter validation failures become protocol-level errors.

Source

Thrown at protocol/a2a/app/agent_executor.py:36

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)


class ManusExecutor(AgentExecutor):
    """Currency Conversion AgentExecutor Example."""

    def __init__(self, agent_factory: Callable[[], Awaitable[A2AManus]]):
        self.agent_factory = agent_factory

    async def execute(
        self,
        context: RequestContext,
        event_queue: EventQueue,
    ) -> None:
        error = self._validate_request(context)
        if error:
            raise ServerError(error=InvalidParamsError())

        query = context.get_user_input()
        try:
            self.agent = await self.agent_factory()
            result = await self.agent.invoke(query, context.context_id)
            print(f"Final Result ===> {result}")
        except Exception as e:
            print("Error invoking agent: %s", e)
            raise ServerError(error=ValueError(f"Error invoking agent: {e}")) from e
        parts = [
            Part(
                root=TextPart(
                    text=(
                        result["content"]
                        if result["content"]
                        else "failed to generate response"
                    )
                ),

View on GitHub (pinned to 52a13f2a57)

Solutions

  1. Inspect what your (or the customized) _validate_request checks and ensure the request satisfies it — typically include a non-empty text part in message.parts.
  2. Log the raw RequestContext (user input, context_id, task_id) before validation to see which field fails.
  3. If you maintain the server, make _validate_request return a descriptive error instead of a bare True/False so clients see which parameter is invalid.
  4. Upgrade the a2a-sdk client/server to matching versions so request serialization matches expectations.

Example fix

# before
def _validate_request(self, context: RequestContext) -> bool:
    return not context.get_user_input()  # empty input -> InvalidParams, no detail
# after
def _validate_request(self, context: RequestContext) -> bool:
    return not (context.message and context.message.parts)  # explicit, documented rule; send a message with text parts
Defensive patterns

Strategy: validation

Validate before calling

msg = context.message
ok = msg is not None and any(
    getattr(p.root, 'text', None) for p in (msg.parts or [])
)
# send only requests where ok is True

Type guard

def has_text_part(context) -> bool:
    m = getattr(context, 'message', None)
    return bool(m and m.parts and any(getattr(p.root, 'kind', None) == 'text' or getattr(p.root, 'text', None) for p in m.parts))

Try / catch

try:
    await client.send_message(request)
except ServerError as e:
    if e.error and e.error.code == -32602:
        # inspect request payload, add missing text part, resend
        pass
    else:
        raise

Prevention

When it happens

Trigger: Sending a request to the executor whose context fails _validate_request (once implemented) — e.g. missing user input, malformed message parts, or invalid context/task parameters. With the current stub, only a customized _validate_request that returns True triggers it.

Common situations: Developers implementing their own validation logic inside _validate_request and then being surprised clients receive -32602; clients that omit required fields (no text part in the message) when calling the A2A endpoint; mismatched SDK versions where RequestContext shape changed.

Related errors


AI-assisted analysis of FoundationAgents/OpenManus@52a13f2a57 (2026-08-15). Data as JSON: /api/errors/f71b85961a92c5c4. Report an issue: GitHub.