{"record":{"id":"dc7b57d5cde3cbc2","repo":"hcengineering/platform","slug":"failed-to-start-multipart-upload","errorCode":null,"errorMessage":"Failed to start multipart upload","messagePattern":"Failed to start multipart upload","errorType":"exception","errorClass":"DatalakeError","httpStatus":null,"severity":"error","filePath":"foundations/server/packages/datalake/src/client.ts","lineNumber":405,"sourceCode":"    workspace: WorkspaceUuid,\n    objectName: string,\n    params: UploadObjectParams\n  ): Promise<MultipartUpload> {\n    const path = `/upload/multipart/${workspace}/${encodeURIComponent(objectName)}`\n    const url = concatLink(this.endpoint, path)\n\n    try {\n      const headers = {\n        ...this.headers,\n        'Content-Type': params.type,\n        'Content-Length': params.size?.toString() ?? '0',\n        'Last-Modified': new Date(params.lastModified).toUTCString()\n      }\n      const response = await fetchSafe(ctx, url, { method: 'POST', headers })\n      return (await response.json()) as MultipartUpload\n    } catch (err: any) {\n      ctx.error('failed to start multipart upload', { workspace, objectName, err })\n      throw new DatalakeError('Failed to start multipart upload')\n    }\n  }\n\n  private async multipartUploadPart (\n    ctx: MeasureContext,\n    workspace: WorkspaceUuid,\n    objectName: string,\n    multipart: MultipartUpload,\n    partNumber: number,\n    data: Readable | Buffer | string\n  ): Promise<MultipartUploadPart> {\n    const path = `/upload/multipart/${workspace}/${encodeURIComponent(objectName)}/part`\n    const url = new URL(concatLink(this.endpoint, path))\n    url.searchParams.set('uploadId', multipart.uploadId)\n    url.searchParams.set('partNumber', partNumber.toString())\n\n    const body = data instanceof Readable ? (Readable.toWeb(data) as ReadableStream) : data\n","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/foundations/server/packages/datalake/src/client.ts#L387-L423","documentation":"multipartUploadStart POSTs to initiate a multipart upload and wraps any failure (network, non-OK status, bad JSON) in a generic DatalakeError('Failed to start multipart upload') after logging the underlying error.","triggerScenarios":"POST to the multipart init endpoint fails: service unreachable, auth rejected, workspace/objectName invalid, or response not valid MultipartUpload JSON.","commonSituations":"Datalake service down or DNS/proxy issues; expired credentials; uploading very large files where multipart is used and the service doesn't support the multipart API version.","solutions":["Inspect the logged underlying err for the root cause","Verify datalake service availability and credentials","Retry with backoff; check server version supports the multipart endpoint"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const mp = await client.multipart(ctx, workspace, objectName, meta)\n} catch (err) {\n  if (err instanceof DatalakeError && err.message === 'Failed to start multipart upload') {\n    // retry with exponential backoff; check service health if retries exhaust\n  } else throw err\n}","preventionTips":["Health-check the datalake service before large multipart operations","Use valid credentials and confirm multipart API support in the server version","Implement idempotent retry logic with backoff for multipart init"],"tags":["network","datalake","multipart-upload"],"backgroundTag":"upload-failed","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}