Budibase/budibase · error

Unable to retrieve object

Error message

Unable to retrieve object

What it means

retrieve() fetches an object from the configured S3-compatible object store using the AWS SDK v3 getObject command. After the call resolves, it checks response.Body — if the SDK returns a response with no body (empty/missing payload), the library cannot produce a usable stream, so it throws this explicit error instead of returning undefined.

Source

Thrown at packages/backend-core/src/objectStore/objectStore.ts:454

/**
 * retrieves the contents of a file from the object store, if it is a known content type it
 * will be converted, otherwise it will be returned as a buffer stream.
 */
export async function retrieve(
  bucketName: string,
  filepath: string
): Promise<string | stream.Readable> {
  return await tracer.trace("retrieve", async span => {
    span.addTags({ bucketName, filepath })
    const objectStore = ObjectStore()
    const params = {
      Bucket: sanitizeBucket(bucketName),
      Key: sanitizeKey(filepath),
    }
    const response = await objectStore.getObject(params)
    if (!response.Body) {
      throw new Error("Unable to retrieve object")
    }
    span.addTags({
      contentLength: response.ContentLength,
      contentType: response.ContentType,
    })
    if (STRING_CONTENT_TYPES.includes(response.ContentType)) {
      span.addTags({ string: true })
      return response.Body.transformToString()
    } else {
      span.addTags({ string: false })
      // this typecast is required - for some reason the AWS SDK V3 defines its own "ReadableStream"
      // found in the @aws-sdk/types package which is meant to be the Node type, but due to the SDK
      // supporting both the browser and Nodejs it is a polyfill which causes a type clash with Node.
      const readableStream =
        response.Body.transformToWebStream() as ReadableStream
      return stream.Readable.fromWeb(readableStream)
    }
  })

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Verify the object actually exists and is non-empty in the bucket (aws s3 ls / MinIO console) — the error usually means a zero-byte or emptied object
  2. Re-upload/re-publish the missing or corrupted asset (e.g. re-publish the app or component library)
  3. Check that the object store (MinIO/S3) and any proxy/CDN in front of it are not stripping response bodies; test with a direct presigned URL
  4. Confirm S3 env config (MINIO_URL, credentials, SELF_HOSTED) points at the correct bucket/region so you are not hitting a wrong-but-existing key

Example fix

// before
const file = await objectStore.retrieve(prodBucket, "manifest.json")
// after
try {
  const file = await objectStore.retrieve(prodBucket, "manifest.json")
} catch (err) {
  if (err.message === "Unable to retrieve object") {
    // fall back or re-publish asset
  }
  throw err
}
Defensive patterns

Strategy: try-catch

Validate before calling

const exists = await objectStore.objectExists(bucket, filepath)
if (!exists) throw new Error(`Object not found: ${filepath}`)

Type guard

function hasBody(r: { Body?: unknown }): r is { Body: NonNullable<typeof r.Body> } {
  return !!r.Body
}

Try / catch

try {
  const file = await objectStore.retrieve(bucket, filepath)
} catch (err) {
  if (err.message === "Unable to retrieve object") {
    // treat as missing/empty asset: fallback or re-publish
  } else throw err
}

Prevention

When it happens

Trigger: Calling retrieve(bucketName, filepath) when the S3 getObject call succeeds at the protocol level but returns a response with an empty Body — e.g. a zero-byte or deleted-while-listing object, or a proxy/MinIO misconfiguration returning an empty 200 response.

Common situations: Serving app definitions, component libraries or plugin JS files (retrieve is used by data, content, getComponentLibraryManifest and pluginJs); hitting an object that was overwritten to zero bytes, a MinIO/CDN proxy stripping the body, or a stale manifest path after an app publish failed halfway.

Related errors


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