mckaywrigley/chatbot-ui · error · Error
Some methods with a requestBody are missing requestBody.cont
Error message
Some methods with a requestBody are missing requestBody.content
What it means
This error is thrown by validateOpenAPI when a path item operation declares a requestBody object but that requestBody has no content property. In OpenAPI, requestBody.content is required to describe the media types and schemas of the request body, so a requestBody without content is invalid and cannot be converted into a function parameter schema by openapiToFunctions.
Source
Thrown at lib/openapi-conversion.ts:64
}
})
if (
Object.values(openapiSpec.paths).some((methods: any) =>
Object.values(methods).some((spec: any) => !spec.operationId)
)
) {
throw new Error("Some methods are missing operationId")
}
if (
Object.values(openapiSpec.paths).some((methods: any) =>
Object.values(methods).some(
(spec: any) => spec.requestBody && !spec.requestBody.content
)
)
) {
throw new Error(
"Some methods with a requestBody are missing requestBody.content"
)
}
if (
Object.values(openapiSpec.paths).some((methods: any) =>
Object.values(methods).some((spec: any) => {
if (spec.requestBody?.content?.["application/json"]?.schema) {
if (
!spec.requestBody.content["application/json"].schema.properties ||
Object.keys(spec.requestBody.content["application/json"].schema)
.length === 0
) {
throw new Error(
`In context=('paths', '${Object.keys(methods)[0]}', '${
Object.keys(spec)[0]
}', 'requestBody', 'content', 'application/json', 'schema'), object schema missing properties`
)View on GitHub (pinned to 81328b61d2)
Solutions
- Add a content object with at least one media type and schema: requestBody: { content: { 'application/json': { schema: { type: 'object', properties: {...} } } } }
- If the operation takes no body, remove the requestBody entirely
- Lint the spec with a tool like @redocly/cli or spectral before passing it to openapiToFunctions
Example fix
// before
post:
requestBody:
required: true
// after
post:
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string Defensive patterns
Strategy: validation
Validate before calling
const ops = Object.values(spec.paths ?? {}).flatMap(m => Object.values(m));
const bad = ops.filter(o => o?.requestBody && !o.requestBody.content).length;
if (bad > 0) throw new Error(`${bad} operations have requestBody without content`); Type guard
const hasValidRequestBody = (op: any): boolean => !op?.requestBody || (typeof op.requestBody.content === 'object' && Object.keys(op.requestBody.content).length > 0);
Try / catch
try { return await openapiToFunctions(spec) } catch (e) { if (e instanceof Error && e.message.includes('requestBody.content')) { /* fix spec and re-validate */ } throw e } Prevention
- Run a spectral/@redocly lint pass on every spec before conversion
- Generate specs from code (zod-to-openapi, tsoa) rather than hand-writing them
When it happens
Trigger: Calling openapiToFunctions with a spec where an operation (e.g. post/put/patch under openapiSpec.paths) contains requestBody: {} or requestBody: {required: true} with no content key, or with content misspelled/undefined. The check is Object.values(methods).some(spec => spec.requestBody && !spec.requestBody.content).
Common situations: Hand-written OpenAPI specs or LLM-generated specs that include an empty requestBody; YAML indentation mistakes putting content under the wrong nesting; specs converted from other formats dropping the content block; using $ref inside requestBody incorrectly so content resolves to undefined.
Related errors
- In context=('paths', '${Object.keys(methods)[0]}', '${Object
- Some object schemas are missing properties
AI-assisted analysis of mckaywrigley/chatbot-ui@81328b61d2 (2026-08-27).
Data as JSON: /api/errors/64af6819fdaafaf9.
Report an issue: GitHub.