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 read

What it means

MongoDB integration's read() switches on query.extra.actionType (find, findOne, aggregate, count/countDocuments, distinct, etc.). If the actionType matches none of the supported read cases, the default branch throws 'actionType <X> does not exist on DB for read'.

Source

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

            options: FindOneAndUpdateOptions
          }
          return await collection.findOneAndUpdate(
            findAndUpdateJson.filter,
            findAndUpdateJson.update,
            {
              ...findAndUpdateJson.options,
              includeResultMetadata: true,
            }
          )
        }
        case "count": {
          return await collection.countDocuments(json)
        }
        case "distinct": {
          return await collection.distinct(json)
        }
        default: {
          throw new Error(
            `actionType ${query.extra.actionType} does not exist on DB for read`
          )
        }
      }
    } catch (err) {
      console.error("Error querying mongodb", err)
      throw err
    } finally {
      await this.client.close()
    }
  }

  async update(query: MongoDBQuery): Promise<UpdateResult> {
    try {
      await this.connect()
      const db = this.client.db(this.config.db)
      const collection = db.collection(query.extra.collection)
      let queryJson = query.json

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Set query.extra.actionType to a supported read action (e.g. "find", "findOne", "aggregate", "count", "distinct")
  2. Re-create the query in the builder to regenerate a valid payload
  3. Whitelist/validate actionType before dispatching the query
  4. Check case sensitivity and spelling of the actionType value

Example fix

// before
const query = { table: "users", json: {}, extra: { actionType: "select" } }
// after
const query = { table: "users", json: {}, extra: { actionType: "find" } }
Defensive patterns

Strategy: validation

Validate before calling

const READ_ACTIONS = ["search", "lookup", "aggregate", "count", "distinct"]
if (!READ_ACTIONS.includes(query.extra?.actionType)) {
  throw new Error(`Invalid read actionType: ${query.extra?.actionType}`)
}
await ds.read(query)

Type guard

function isReadAction(t: unknown): t is "search" | "lookup" | "aggregate" | "count" | "distinct" {
  return typeof t === "string" && ["search", "lookup", "aggregate", "count", "distinct"].includes(t)
}

Try / catch

try {
  return await ds.read(query)
} catch (err) {
  if (err.message.includes("does not exist on DB for read")) {
    throw new Error(`Unsupported MongoDB read action "${query.extra?.actionType}"; use search, lookup, aggregate, count or distinct`, { cause: err })
  }
  throw err
}

Prevention

When it happens

Trigger: Executing a read query whose actionType is misspelled, empty, or belongs to another operation family (e.g. 'insertOne', 'deleteMany') instead of a supported read action.

Common situations: Queries migrated or hand-edited with wrong actionType; copy-pasting payloads from another connector; typos like 'findmany' or 'Find'.

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/7457ba4bf116b56f. Report an issue: GitHub.