Budibase/budibase · error

Unable to get bulk documents: ${missingIds}

Error message

Unable to get bulk documents: ${missingIds}

What it means

getMultiple fetches many docs by id via bulk fetch; CouchDB returns a row for every requested key with an 'error' entry for missing ones. Unless allowMissing is set, any missing row causes an error listing the missing ids, since partial results would be silently wrong.

Source

Thrown at packages/backend-core/src/db/couch/DatabaseImpl.ts:262

    })
    const rowUnavailable = (row: RowResponse<T>) => {
      // row is deleted - key lookup can return this
      if (
        (includeDocs && row.doc == null) ||
        (row.value && "deleted" in row.value && row.value.deleted)
      ) {
        return true
      }
      return row.error === "not_found"
    }

    const rows = response.rows.filter(row => !rowUnavailable(row))
    const someMissing = rows.length !== response.rows.length
    // some were filtered out - means some missing
    if (!opts?.allowMissing && someMissing) {
      const missing = response.rows.filter(row => rowUnavailable(row))
      const missingIds = missing.map(row => row.key).join(", ")
      throw new Error(`Unable to get bulk documents: ${missingIds}`)
    }
    return rows.map(row => (includeDocs ? row.doc! : row.value))
  }

  async remove(idOrDoc: string | Document, rev?: string) {
    // not a read call - but don't create a DB to delete a document
    return this.performCall(db => {
      let _id: string
      let _rev: string

      if (isDocument(idOrDoc)) {
        _id = idOrDoc._id!
        _rev = idOrDoc._rev!
      } else {
        _id = idOrDoc
        _rev = rev!
      }

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Pass { allowMissing: true } if partial results are acceptable and handle absent docs downstream
  2. Filter the id list against existing docs before bulk fetching, or re-fetch after deletion races
  3. Treat the error message's missingIds list to reconcile/clean the source data

Example fix

// before
const docs = await db.getMultiple(ids) // throws on any missing
// after
const rows = await db.getMultiple(ids, { allowMissing: true })
const found = rows.filter(Boolean)
Defensive patterns

Strategy: fallback

Try / catch

try {
  const docs = await db.getMultiple(ids)
} catch (err) {
  if (err.message.startsWith("Unable to get bulk documents")) {
    // retry with allowMissing or resync the id list
    const partial = await db.getMultiple(ids, { allowMissing: true })
  } else throw err
}

Prevention

When it happens

Trigger: Calling getMultiple(ids) where one or more ids do not exist in the DB and opts.allowMissing is not true.

Common situations: Stale id lists after deletions, ids from another tenant/environment's DB, race between listing and fetching, users deleting docs while a batch job runs.

Related errors


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