Budibase/budibase · error · Error

actionType ${query.extra.actionType} does not exist on DB fo

Error message

actionType ${query.extra.actionType} does not exist on DB for create

What it means

MongoDB integration's create() switches on query.extra.actionType to choose insertOne or insertMany. If the actionType is neither, the default branch throws 'actionType <X> does not exist on DB for create', meaning the JSON action sent to the connector is not a supported create operation.

Source

Thrown at packages/server/src/integrations/mongodb.ts:494

    query: MongoDBQuery
  ): Promise<InsertOneResult | InsertManyResult> {
    try {
      await this.connect()
      const db = this.client.db(this.config.db)
      const collection = db.collection(query.extra.collection)
      let json = this.createObjectIds(query.json)

      // For mongodb we add an extra actionType to specify
      // which method we want to call on the collection
      switch (query.extra.actionType) {
        case "insertOne": {
          return await collection.insertOne(json)
        }
        case "insertMany": {
          return await collection.insertMany(json)
        }
        default: {
          throw new Error(
            `actionType ${query.extra.actionType} does not exist on DB for create`
          )
        }
      }
    } catch (err) {
      console.error("Error writing to mongodb", err)
      throw err
    } finally {
      await this.client.close()
    }
  }

  async read(query: MongoDBQuery): Promise<NonNullable<unknown>> {
    try {
      await this.connect()
      const db = this.client.db(this.config.db)
      const collection = db.collection(query.extra.collection)
      let json = this.createObjectIds(query.json)

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Set query.extra.actionType to exactly "insertOne" or "insertMany" for create queries
  2. Re-create the query in the Budibase builder so it emits a valid actionType
  3. Validate the JSON payload's actionType before executing (whitelist check)
  4. Check for typos/case mismatches (e.g. 'InsertOne' vs 'insertOne')

Example fix

// before
const query = { table: "users", json: { name: "x" }, extra: { actionType: "insert" } }
// after
const query = { table: "users", json: { name: "x" }, extra: { actionType: "insertOne" } }
Defensive patterns

Strategy: validation

Validate before calling

const CREATE_ACTIONS = ["insertOne", "insertMany"]
if (!CREATE_ACTIONS.includes(query.extra?.actionType)) {
  throw new Error(`Invalid create actionType: ${query.extra?.actionType}`)
}
await ds.create(query)

Type guard

function isCreateAction(t: unknown): t is "insertOne" | "insertMany" {
  return t === "insertOne" || t === "insertMany"
}

Try / catch

try {
  await ds.create(query)
} catch (err) {
  if (err.message.includes("does not exist on DB for create")) {
    throw new Error(`Unsupported MongoDB create action "${query.extra?.actionType}"; use insertOne or insertMany`, { cause: err })
  }
  throw err
}

Prevention

When it happens

Trigger: Executing a MongoDB query in Budibase whose configured create actionType is misspelled, empty, or an action that belongs to read/update/delete (e.g. 'find', 'updateOne') — anything outside { insertOne, insertMany }.

Common situations: Hand-edited or imported query definitions with an invalid actionType; REST-like payloads copied from a different datasource; version drift where a query was built against different action names.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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