{"record":{"id":"106e8995c571a748","repo":"mastra-ai/mastra","slug":"schema-unavailable","errorCode":"SCHEMA_UNAVAILABLE","errorMessage":"SCHEMA_UNAVAILABLE: This command does not accept JSON input","messagePattern":"SCHEMA_UNAVAILABLE: This command does not accept JSON input","errorType":"error_code","errorClass":"ApiCliError","httpStatus":null,"severity":"warning","filePath":"packages/cli/src/commands/api/schema.ts","lineNumber":9,"sourceCode":"import { fetchSchemaManifest } from './client.js';\nimport { ApiCliError } from './errors.js';\nimport { LEARNING_ROUTE_SCHEMAS } from './learning-route-metadata.js';\nimport type { ResolvedTarget } from './target.js';\nimport type { ApiCommandDescriptor, ApiCommandExample } from './types.js';\n\nexport async function getCommandSchema(descriptor: ApiCommandDescriptor, target: ResolvedTarget): Promise<unknown> {\n  if (!descriptor.acceptsInput) {\n    throw new ApiCliError('SCHEMA_UNAVAILABLE', 'This command does not accept JSON input');\n  }\n\n  // Learning routes live on the Mastra platform learning endpoint, which does\n  // not expose a schema manifest; resolve their hand-authored schemas locally.\n  const learningSchema = (\n    LEARNING_ROUTE_SCHEMAS as Partial<\n      Record<string, (typeof LEARNING_ROUTE_SCHEMAS)[keyof typeof LEARNING_ROUTE_SCHEMAS]>\n    >\n  )[`${descriptor.method} ${descriptor.path}`];\n  if (learningSchema) {\n    return buildRouteSchema(descriptor, learningSchema);\n  }\n\n  const manifest = await fetchSchemaManifest(target.baseUrl, target.headers, target.timeoutMs, target.apiPrefix);\n  if (!manifest || typeof manifest !== 'object' || !Array.isArray((manifest as { routes?: unknown }).routes)) {\n    throw new ApiCliError('SCHEMA_UNAVAILABLE', 'Target server returned an invalid schema manifest', {\n      reason: 'invalid_manifest',\n    });","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/cli/src/commands/api/schema.ts#L1-L27","documentation":"getCommandSchema fetches the route schema (for validation/verbose mode) but first checks descriptor.acceptsInput. Commands that take no JSON input cannot have a meaningful input schema, so the CLI throws SCHEMA_UNAVAILABLE with 'This command does not accept JSON input' instead of fetching a manifest.","triggerScenarios":"Requesting a schema (e.g. `mastra api <cmd> --schema` or verbose schema display) for a command whose descriptor has acceptsInput: false — typically GET/list commands with no body, or running parse-with-input style flows against such commands.","commonSituations":"Assuming every subcommand supports --input/--show-schema; scripting a loop that requests schemas for all commands including input-less ones; a descriptor marked acceptsInput:false after a version change renamed or restructured a command.","solutions":["Only request schemas for commands that document JSON input support","Drop the --input/--schema flag for this command and pass any identifiers as positional arguments","Check the command's help/descriptor to confirm acceptsInput","Update scripts to skip schema retrieval for body-less commands"],"exampleFix":"// before\nmastra api agents list --schema\n// after\nmastra api agents list","handlingStrategy":"fallback","validationCode":"if (!commandDescriptor.acceptsInput) {\n  // skip --input/--schema handling entirely\n  return runCommandWithoutBody(commandDescriptor);\n}","typeGuard":"function acceptsJsonInput(d: { acceptsInput?: boolean }): boolean { return d.acceptsInput === true; }","tryCatchPattern":"try { await showSchema(cmd); } catch (e) { if (String(e).includes('SCHEMA_UNAVAILABLE')) return null; throw e; }","preventionTips":["Check the descriptor's acceptsInput flag before requesting schemas","Only pass --input to commands that document a JSON body","Use positionals/flags for GET-style commands without bodies","Filter schema-fetch loops in scripts to acceptsInput commands only"],"tags":["cli","schema","unsupported-operation"],"backgroundTag":"schema-unavailable","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}