hcengineering/platform · error · DatalakeError

Missing response body

Error message

Missing response body

What it means

getObject fetches a blob from the datalake service and returns it as a readable stream. If the HTTP response succeeds but has a null body, the client logs 'bad datalake response' and throws DatalakeError('Missing response body').

Source

Thrown at foundations/server/packages/datalake/src/client.ts:140

    return (await response.json()) as ListObjectOutput
  }

  async getObject (ctx: MeasureContext, workspace: WorkspaceUuid, objectName: string): Promise<Readable | undefined> {
    const url = this.getObjectUrl(ctx, workspace, objectName)

    let response
    try {
      response = await fetchSafe(ctx, url, { headers: { ...this.headers } })
    } catch (err: any) {
      if (err.name === 'NotFoundError') {
        return undefined
      }
      throw err
    }

    if (response.body == null) {
      ctx.error('bad datalake response', { objectName })
      throw new DatalakeError('Missing response body')
    }

    return Readable.fromWeb(response.body as any)
  }

  async getPartialObject (
    ctx: MeasureContext,
    workspace: WorkspaceUuid,
    objectName: string,
    offset: number,
    length?: number
  ): Promise<Readable | undefined> {
    const url = this.getObjectUrl(ctx, workspace, objectName)
    const headers = {
      ...this.headers,
      Range: length !== undefined ? `bytes=${offset}-${offset + length - 1}` : `bytes=${offset}`
    }

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Verify the object exists via statObject before/after the failure
  2. Check proxy/gateway config (nginx buffering, minio/datalake endpoint) so bodies pass through
  3. Retry the request; inspect datalake server logs for the objectName
Defensive patterns

Strategy: try-catch

Validate before calling

const stat = await client.statObject(ctx, workspace, objectName)
if (stat == null) throw new Error(`object ${objectName} does not exist`)
if (stat.size === 0) console.warn(`object ${objectName} is empty; body may be null`)

Try / catch

try {
  const stream = await client.getObject(ctx, workspace, objectName)
} catch (err) {
  if (err instanceof DatalakeError && err.message === 'Missing response body') {
    // retry once, then fail with a clear message
  } else throw err
}

Prevention

When it happens

Trigger: GET object succeeds at HTTP level but the proxy/gateway strips the body, or the server returns an empty/204-style response for an existing objectName.

Common situations: Reverse proxy misconfiguration swallowing bodies; datalake service returning empty responses under error conditions not mapped to HTTP status; requesting an object whose content was truncated/lost server-side.

Related errors


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/95b42a7e880f1e7f. Report an issue: GitHub.