hcengineering/platform · error · DatalakeError

Upload failed:

Error message

Upload failed: 

What it means

After a successful form-data upload, the single BlobUploadResult is checked for an 'error' field; if present, DatalakeError('Upload failed: <server error>') is thrown with the server-provided reason.

Source

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

    form.append('file', file)

    const response = await fetchSafe(ctx, url, {
      method: 'POST',
      body: form as unknown as BodyInit,
      headers: {
        ...this.headers
      }
    })

    const result = (await response.json()) as BlobUploadResult[]
    if (result.length !== 1) {
      throw new DatalakeError('Bad datalake response: ' + result.toString())
    }

    const uploadResult = result[0]

    if ('error' in uploadResult) {
      throw new DatalakeError('Upload failed: ' + uploadResult.error)
    }

    return uploadResult.metadata
  }

  async uploadWithMultipart (
    ctx: MeasureContext,
    workspace: WorkspaceUuid,
    objectName: string,
    stream: Readable | Buffer | string,
    params: UploadObjectParams
  ): Promise<ObjectMetadata> {
    const chunkSize = 10 * 1024 * 1024

    const multipart = await this.multipartUploadStart(ctx, workspace, objectName, params)

    try {
      const parts: MultipartUploadPart[] = []

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Read the server error appended in the message and fix the underlying cause (permissions, quota, name)
  2. Retry the upload with a valid objectName
  3. Check datalake server logs for the corresponding upload failure
Defensive patterns

Strategy: try-catch

Type guard

function isUploadOk(r: BlobUploadResult): boolean {
  return !('error' in r)
}

Try / catch

try {
  await client.putObject(ctx, workspace, objectName, stream)
} catch (err) {
  if (err instanceof DatalakeError && err.message.startsWith('Upload failed:')) {
    const reason = err.message.slice('Upload failed: '.length)
    // act on server-provided reason (permissions, quota, name)
  } else throw err
}

Prevention

When it happens

Trigger: The datalake accepted the request but the per-blob upload result carries an error — e.g. bucket/workspace permissions, quota exceeded, name conflicts, or backend write failure.

Common situations: Insufficient permissions on the target workspace/container; object name policy violations; disk-full or backend storage errors server-side.

Related errors


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