Budibase/budibase · error · HTTPError

At least one operation field is required

Error message

At least one operation field is required

What it means

This error is thrown when updating an agent operation with an empty request body. The controller requires at least one field to modify; an empty JSON object ({}) gives the underlying sdk.ai.agents.updateOperation nothing to do, so it is rejected with 400.

Source

Thrown at packages/server/src/api/controllers/ai/agentOperations.ts:47

    escalation: body.escalation,
  })

  ctx.body = toAgentResponse(agent)
  ctx.status = 201
}

export async function updateAgentOperation(
  ctx: UserCtx<
    UpdateAgentOperationRequest,
    AgentOperationMutationResponse,
    { agentId: string; operationId: string }
  >
) {
  const { agentId, operationId } = ctx.params
  const body = ctx.request.body

  if (!Object.keys(body).length) {
    throw new HTTPError("At least one operation field is required", 400)
  }

  const agent = await sdk.ai.agents.updateOperation(agentId, operationId, body)

  ctx.body = toAgentResponse(agent)
  ctx.status = 200
}

export async function deleteAgentOperation(
  ctx: UserCtx<
    void,
    AgentOperationMutationResponse,
    { agentId: string; operationId: string }
  >
) {
  const { agentId, operationId } = ctx.params

  const agent = await sdk.ai.agents.removeOperation(agentId, operationId)

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Include at least one operation field in the JSON body
  2. Ensure the request sets Content-Type: application/json and the body is actually parsed
  3. Fix client logic that conditionally builds the payload so it never sends an empty object
  4. If no changes are needed, skip the API call entirely instead of issuing an empty update

Example fix

// before
await api.patch(`/ai/agents/${agentId}/operations/${opId}`, {})
// after
await api.patch(`/ai/agents/${agentId}/operations/${opId}`, { enabled: false })
Defensive patterns

Strategy: validation

Validate before calling

function assertNonEmptyUpdate(body) {
  if (!body || typeof body !== "object" || Object.keys(body).length === 0) {
    throw new Error("update requires at least one operation field")
  }
  return body
}
assertNonEmptyUpdate(payload)

Type guard

function hasUpdateFields(b) {
  return typeof b === "object" && b !== null && Object.keys(b).length > 0
}

Try / catch

try {
  await updateAgentOperation(agentId, operationId, payload)
} catch (err) {
  if (err.status === 400 && err.message === "At least one operation field is required") {
    console.warn("skipped empty update")
    return
  }
  throw err
}

Prevention

When it happens

Trigger: Sending PUT/PATCH to the agent operation endpoint with body {} , an empty form body, or a Content-Type/body mismatch that results in ctx.request.body being an empty object. The check is Object.keys(body).length === 0.

Common situations: HTTP clients sending PATCH with no body; middleware stripping the body due to missing Content-Type: application/json; code paths that build the update payload conditionally and end up with no fields; proxy or serialization dropping empty objects.

Related errors


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/bc31e80e54fe9c66. Report an issue: GitHub.