{"record":{"id":"d294858796781cee","repo":"google-gemini/gemini-cli","slug":"remote-agent-definition-name-requires-a-strin-d29485","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-session-invocation.ts","lineNumber":79,"sourceCode":"   * Format: `name::targetUrl` (or just `name` if no URL can be derived).\n   */\n  private static sessionKey(definition: RemoteAgentDefinition): string {\n    const url = getRemoteAgentTargetUrl(definition);\n    return url ? `${definition.name}::${url}` : definition.name;\n  }\n\n  private readonly _onAgentEvent?: (event: AgentEvent) => void;\n\n  constructor(\n    private readonly definition: RemoteAgentDefinition,\n    private readonly context: AgentLoopContext,\n    params: AgentInputs,\n    messageBus: MessageBus,\n    options?: SubagentInvocationOptions,\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      options?.toolName ?? definition.name,\n      options?.toolDisplayName ?? definition.displayName,\n    );\n    this._onAgentEvent = options?.onAgentEvent;\n\n    // Validate that A2AClientManager is available at construction time\n    if (!this.context.config.getA2AClientManager()) {\n      throw new Error(\n        `Failed to initialize RemoteSessionInvocation for '${definition.name}': A2AClientManager is not available.`,\n      );\n    }","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/5024443c7217464a66e98f80d73172a26440bd8f/packages/core/src/agents/remote-session-invocation.ts#L61-L97","documentation":"Thrown in the RemoteSessionInvocation constructor (the session-based variant) when params['query'] is present but not a string. Identical semantics to error 214: a missing query falls back to DEFAULT_QUERY_STRING ('Get Started!') and does NOT throw; only an explicitly non-string value does.","triggerScenarios":"Constructing RemoteSessionInvocation with params.query of a non-string type (number, object, array, boolean). The check runs in the constructor before super(...).","commonSituations":"Caller passes a structured object or non-string scalar as the query; a serialization layer parsed query into a number; programmatic misuse; mismatched param schema at the dispatch boundary.","solutions":["Pass query as a string from the caller.","Coerce or validate before construction: typeof params.query === 'string'.","If query is optional, omit the key so the default applies."],"exampleFix":"// before\nnew RemoteSessionInvocation(def, ctx, { query: { text: 'hi' } }, bus, opts);\n\n// after\nnew RemoteSessionInvocation(def, ctx, { query: 'hi' }, bus, opts);","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":["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"}