{"record":{"id":"10acad4721d9d146","repo":"Budibase/budibase","slug":"unable-to-retrieve-metadata-from-object","errorCode":null,"errorMessage":"Unable to retrieve metadata from object","messagePattern":"Unable to retrieve metadata from object","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/backend-core/src/objectStore/objectStore.ts","lineNumber":819,"sourceCode":"}\n\nexport async function getObjectMetadata(\n  bucket: string,\n  path: string\n): Promise<HeadObjectCommandOutput> {\n  bucket = sanitizeBucket(bucket)\n  path = sanitizeKey(path)\n\n  const client = ObjectStore()\n  const params = {\n    Bucket: bucket,\n    Key: path,\n  }\n\n  try {\n    return await client.headObject(params)\n  } catch (err: any) {\n    throw new Error(\"Unable to retrieve metadata from object\")\n  }\n}\n\nexport async function objectExists(\n  bucket: string,\n  path: string\n): Promise<boolean> {\n  bucket = sanitizeBucket(bucket)\n  path = sanitizeKey(path)\n\n  const client = ObjectStore()\n  const params = {\n    Bucket: bucket,\n    Key: path,\n  }\n\n  try {\n    await client.headObject(params)","sourceCodeStart":801,"sourceCodeEnd":837,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/backend-core/src/objectStore/objectStore.ts#L801-L837","documentation":"This helper calls the S3 client's headObject to fetch object metadata (size, content type, last modified). headObject throws when the key does not exist or the store is unreachable; the catch clause swallows the original error and rethrows a generic 'Unable to retrieve metadata from object' Error.","triggerScenarios":"objectExists/metadata lookup for a key that does not exist (404 NoSuchKey), wrong bucket name, invalid/expired credentials (403), or network failure to the S3/MinIO endpoint. Note the original error is discarded, so the real cause is hidden.","commonSituations":"Checking existence of an attachment whose key was deleted by another process, misconfigured bucket names between environments, MinIO not running in self-hosted dev, or credential rotation breaking access.","solutions":["Check the S3/MinIO endpoint is reachable and the bucket/key actually exist (headObject 404 is the most common underlying cause)","Verify credentials and bucket policy — 403 from wrong keys is masked by this generic error","Add temporary logging at the catch site to capture the swallowed err for diagnosis (or patch locally to include err.message)","Confirm SELF_HOSTED/MINIO env vars match the environment (dev vs prod) so lookups target the right store"],"exampleFix":"// before\n} catch (err: any) {\n  throw new Error(\"Unable to retrieve metadata from object\")\n}\n// after\n} catch (err: any) {\n  throw new Error(`Unable to retrieve metadata from object: ${err?.name ?? \"unknown\"}`)\n}","handlingStrategy":"try-catch","validationCode":"const exists = await objectStore.objectExists(bucket, path)\nif (!exists) { /* skip or create */ }","typeGuard":null,"tryCatchPattern":"try {\n  await objectStore.getObjectMetadata(bucket, path)\n} catch (err) {\n  if (err.message === \"Unable to retrieve metadata from object\") {\n    // original cause is swallowed: check bucket/key/credentials directly\n  }\n  throw err\n}","preventionTips":["Treat this error as 'not found OR store unreachable' and check the store health first","Verify credentials/bucket env config per environment","Run headObject directly with the SDK when debugging to see the real error","Keep MinIO/S3 services monitored in self-hosted installs"],"tags":["s3","object-store","metadata"],"backgroundTag":"s3-lookup-failed","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}