{"record":{"id":"b13b8a802dd7b5b0","repo":"ComposioHQ/composio","slug":"experimental-subagent-requires-a-non-empty-promp","errorCode":null,"errorMessage":"experimental_subAgent() requires a non-empty prompt string.","messagePattern":"experimental_subAgent\\(\\) requires a non-empty prompt string\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ts/packages/cli/src/services/run-helpers-runtime.ts","lineNumber":835,"sourceCode":"  const resolveInvokeAgentTarget = (requestedTarget?: string): 'claude' | 'codex' => {\n    if (requestedTarget === 'claude' || requestedTarget === 'codex') return requestedTarget;\n    const configuredTarget = readConfiguredExperimentalSubagentTarget(helperContext.cliConfigPath);\n    if (configuredTarget === 'claude' || configuredTarget === 'codex') return configuredTarget;\n    const detected = requestedTarget === 'user' ? 'user' : detectInvokeAgentMaster();\n    if (detected === 'codex' || detected === 'claude') return detected;\n    if (typeof Bun.which === 'function' && Bun.which('codex')) return 'codex';\n    if (typeof Bun.which === 'function' && Bun.which('claude')) return 'claude';\n    throw new Error(\n      'experimental_subAgent() could not determine an agent CLI. Current master is user; install codex or claude, or pass { target: \"codex\" | \"claude\" }.'\n    );\n  };\n\n  const experimentalSubAgentImpl = async (\n    prompt: string,\n    options: Record<string, unknown> = {}\n  ) => {\n    if (typeof prompt !== 'string' || prompt.trim().length === 0) {\n      throw new Error('experimental_subAgent() requires a non-empty prompt string.');\n    }\n    const logFilePath =\n      typeof helperContext.runLogFilePath === 'string' && helperContext.runLogFilePath.length > 0\n        ? helperContext.runLogFilePath\n        : undefined;\n    const normalizedOptions = normalizeInvokeAgentOptions(options);\n    const target = resolveInvokeAgentTarget(normalizedOptions.target);\n    const master = detectInvokeAgentMaster();\n    helperDebugLog('subAgent.target', {\n      requestedTarget: normalizedOptions.target ?? null,\n      resolvedTarget: target,\n      master,\n    });\n    const response = await invokeAcpSubAgent({\n      prompt: prompt.trim(),\n      options: normalizedOptions,\n      master,\n      target,","sourceCodeStart":817,"sourceCodeEnd":853,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/cli/src/services/run-helpers-runtime.ts#L817-L853","documentation":"experimental_subAgent()'s first argument must be a non-empty string prompt; the implementation trims it and throws if it is not a string or is whitespace-only before doing any work.","triggerScenarios":"Calling experimental_subAgent(''), experimental_subAgent('   '), or passing a non-string such as an array of messages, an object, or an undefined variable.","commonSituations":"Prompt built from a template whose variables are empty, optional user input passed through without a default, or passing a chat-messages array (OpenAI-style) instead of a plain prompt string.","solutions":["Pass a non-empty prompt string","Guard dynamic prompts: if (!prompt?.trim()) return / throw early","Assemble the prompt with fallbacks, e.g. prompt ?? defaultPrompt"],"exampleFix":"// before\nawait experimental_subAgent(userInput); // userInput may be ''\n// after\nconst prompt = userInput?.trim();\nif (!prompt) throw new Error('Prompt is required');\nawait experimental_subAgent(prompt);","handlingStrategy":"validation","validationCode":"if (typeof prompt !== 'string' || prompt.trim().length === 0) throw new TypeError('prompt required');\nawait experimental_subAgent(prompt);","typeGuard":"const isNonEmptyPrompt = (v: unknown): v is string => typeof v === 'string' && v.trim().length > 0;","tryCatchPattern":null,"preventionTips":["Validate user-sourced prompts at the boundary","Provide default prompt templates so the string is never empty"],"tags":["subagent","prompt","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}