ComposioHQ/composio · error · Error
Missing required flag: ${name}
Error message
Missing required flag: ${name} What it means
The run-subagent-output-mcp helper script reads two flags from process.argv via readFlag, which throws when the flag is absent or has no following value. The flags used are the schema file path and result file path required to serve structured output over MCP.
Source
Thrown at ts/packages/cli/src/services/run-subagent-output-mcp.ts:19
import process from 'node:process';
import { jsonSchemaToZod } from '@composio/json-schema-to-zod';
import { FileSystem } from '@effect/platform';
import { BunFileSystem } from '@effect/platform-bun';
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import { Effect } from 'effect';
import {
ACP_STRUCTURED_OUTPUT_TOOL_NAME,
buildStructuredOutputToolSchema,
decodeStructuredSchemaJson,
} from 'src/services/run-subagent-shared';
import { TerminalUI, TerminalUILive } from 'src/services/terminal-ui';
const readFlag = (name: string): string => {
const index = process.argv.indexOf(name);
const value = index >= 0 ? process.argv[index + 1] : undefined;
if (!value) {
throw new Error(`Missing required flag: ${name}`);
}
return value;
};
const main = async (): Promise<void> => {
const fs = Effect.runSync(FileSystem.FileSystem.pipe(Effect.provide(BunFileSystem.layer)));
const schemaFilePath = readFlag('--schema-file');
const resultFilePath = readFlag('--result-file');
const schemaText = await Effect.runPromise(fs.readFileString(schemaFilePath));
const structuredSchema = decodeStructuredSchemaJson(schemaText);
const toolInputSchema = jsonSchemaToZod(buildStructuredOutputToolSchema(structuredSchema));
const server = new McpServer({
name: 'composio-subagent-output',
version: '1.0.0',
});
server.registerTool(View on GitHub (pinned to 64b1b85502)
Solutions
- Invoke the script through the parent composio CLI rather than directly, so flags are passed for you
- If invoking directly, supply both required flags with values: node run-subagent-output-mcp.js <schema-flag> <path> <result-flag> <path>
- Upgrade the CLI so caller and helper flag names match
Defensive patterns
Strategy: validation
Validate before calling
const need = (flag: string) => { const i = process.argv.indexOf(flag); const v = process.argv[i+1]; if (i < 0 || !v) throw new Error(`Missing required flag: ${flag}`); return v; }; Prevention
- Don't invoke internal helper scripts directly; use the parent CLI
- Arg-check at process start and print usage instead of throwing mid-run
When it happens
Trigger: Launching the run-subagent-output-mcp entrypoint without the expected --<flag> <value> pairs on the command line, or with a flag at the end of argv followed by nothing.
Common situations: Invoking the internal helper script manually instead of through the parent CLI, a wrapper/quoting bug dropping arguments, or a CLI version change renaming the flags.
Related errors
- experimental_subAgent() target must be "claude", "codex", or
- experimental_subAgent() requires Zod 4 with z.toJSONSchema()
- experimental_subAgent() schema must be a Zod schema or JSON
- experimental_subAgent() could not determine an agent CLI. Cu
- experimental_subAgent() requires a non-empty prompt string.
AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28).
Data as JSON: /api/errors/22fcbea1aa99de7a.
Report an issue: GitHub.