{"record":{"id":"4166f94cf01751ee","repo":"google-gemini/gemini-cli","slug":"remote-agent-definition-name-requires-a-strin","errorCode":null,"errorMessage":"Remote agent '${definition.name}' requires a string 'query' input.","messagePattern":"Remote agent '(.+?)' requires a string 'query' input\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/agents/remote-invocation.ts","lineNumber":68,"sourceCode":"  >();\n  // State for the ongoing conversation with the remote agent\n  private contextId: string | undefined;\n  private taskId: string | undefined;\n\n  private readonly clientManager: A2AClientManager;\n  private authHandler: AuthenticationHandler | undefined;\n\n  constructor(\n    private readonly definition: RemoteAgentDefinition,\n    private readonly context: AgentLoopContext,\n    params: AgentInputs,\n    messageBus: MessageBus,\n    _toolName?: string,\n    _toolDisplayName?: string,\n  ) {\n    const query = params['query'] ?? DEFAULT_QUERY_STRING;\n    if (typeof query !== 'string') {\n      throw new Error(\n        `Remote agent '${definition.name}' requires a string 'query' input.`,\n      );\n    }\n    // Safe to pass strict object to super\n    super(\n      { query },\n      messageBus,\n      _toolName ?? definition.name,\n      _toolDisplayName ?? definition.displayName,\n    );\n    const clientManager = this.context.config.getA2AClientManager();\n    if (!clientManager) {\n      throw new Error(\n        `Failed to initialize RemoteAgentInvocation for '${definition.name}': A2AClientManager is not available.`,\n      );\n    }\n    this.clientManager = clientManager;\n  }","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/5024443c7217464a66e98f80d73172a26440bd8f/packages/core/src/agents/remote-invocation.ts#L50-L86","documentation":"Thrown in the RemoteAgentInvocation constructor when params['query'] is present but not a string. Note the fallback `params['query'] ?? DEFAULT_QUERY_STRING` means a missing query uses the default 'Get Started!' and does NOT throw; only an explicitly non-string query (number, object, array, boolean) triggers this.","triggerScenarios":"Constructing RemoteAgentInvocation with params = { query: 123 } or { query: {...} } or { query: true }. Omitting query is safe (default applies).","commonSituations":"Tool-dispatch layer passing a structured object or number as query instead of a string; a serialized JSON payload where query was parsed as a non-string scalar; programmatic misuse of the invocation class.","solutions":["Ensure the caller passes query as a string: String(params.query) or a typed check before construction.","If the query is optional, omit the key rather than passing a non-string.","Type the params at the call site with RemoteAgentInputs / { query: string }."],"exampleFix":"// before\nnew RemoteAgentInvocation(def, ctx, { query: 42 }, bus);\n\n// after\nnew RemoteAgentInvocation(def, ctx, { query: 'Summarize the report' }, bus);","handlingStrategy":"type-guard","validationCode":"function normalizeQuery(params) {\n  const q = params['query'] ?? 'Get Started!';\n  if (typeof q !== 'string') throw new Error('query must be a string');\n  return { query: q };\n}","typeGuard":"function isStringQuery(params) {\n  const q = params['query'];\n  return q === undefined || typeof q === 'string';\n}","tryCatchPattern":null,"preventionTips":["Always pass query as a string at the dispatch boundary.","Type params as { query: string } (RemoteAgentInputs).","Omit query rather than passing a non-string when it is optional."],"tags":["a2a","agents","type-validation","config"],"backgroundTag":null,"analyzedSha":"5024443c7217464a66e98f80d73172a26440bd8f","analyzedAt":"2026-08-12T06:01:53.711Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}