mckaywrigley/chatbot-ui · error · Error

In context=('paths', '${Object.keys(methods)[0]}', '${Object

Error message

In context=('paths', '${Object.keys(methods)[0]}', '${Object.keys(spec)[0]}', 'requestBody', 'content', 'application/json', 'schema'), object schema missing properties

What it means

During validation, any operation whose application/json request body schema exists but has no properties (or an empty properties object) triggers this contextual error. openapiToFunctions converts each JSON body schema into typed function parameters, so an object schema without properties would produce a function with an unusable parameter list, hence the guard.

Source

Thrown at lib/openapi-conversion.ts:78

        (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`
            )
          }
        }
      })
    )
  ) {
    throw new Error("Some object schemas are missing properties")
  }
}

export const openapiToFunctions = async (
  openapiSpec: any
): Promise<OpenAPIData> => {
  const functions: any[] = [] // Define a proper type for function objects
  const routes: {

View on GitHub (pinned to 81328b61d2)

Solutions

  1. Add the missing properties to the schema: schema: { type: 'object', properties: { ... }, required: [...] }
  2. If properties live in a component, use allOf/$ref so the inline schema resolves to actual fields, or inline them
  3. If the body genuinely has no fields, consider removing the requestBody from that operation

Example fix

// before
schema:
  type: object
// after
schema:
  type: object
  properties:
    id:
      type: string
Defensive patterns

Strategy: validation

Validate before calling

const schema = op?.requestBody?.content?.['application/json']?.schema;
const ok = !schema || (schema.properties && Object.keys(schema.properties).length > 0);
if (!ok) throw new Error(`empty object schema on ${opId}`);

Type guard

const schemaHasProperties = (s: any): boolean =>
  !s || s.type !== 'object' || (s.properties && Object.keys(s.properties).length > 0);

Try / catch

catch (e) { if (e.message.includes('object schema missing properties')) { console.error('Fix spec at', e.message.match(/context=([^ ]+)/)?.[0]); } throw e; }

Prevention

When it happens

Trigger: An operation with requestBody.content['application/json'].schema set to {type: 'object'} with no properties key, an empty properties: {}, or a schema whose top-level keys (e.g. only $ref/type) make properties falsy/empty. Triggered per-operation during openapiToFunctions validation.

Common situations: Placeholder schemas like schema: {type: 'object'} left in drafts; specs where all fields were moved to $ref'd definitions leaving the inline object empty; LLM-generated specs; refactoring that deleted properties but left the schema shell.

Related errors


AI-assisted analysis of mckaywrigley/chatbot-ui@81328b61d2 (2026-08-27). Data as JSON: /api/errors/dc5615e35cc4747c. Report an issue: GitHub.