hcengineering/platform · error

Invalid upload id

Error message

Invalid upload id

What it means

parseUploadId splits the upload id path value on '/' and requires both a uuid and an uploadId segment; if either is missing it throws Error('Invalid upload id'). Multipart upload part/complete/abort handlers depend on this format.

Source

Thrown at services/datalake/pod-datalake/src/handlers/multipart.ts:162

    return
  }

  const { bucket } = await datalake.selectStorage(ctx, workspace)
  await bucket.abortMultipartUpload(ctx, uuid, { uploadId })

  ctx.info('multipart-abort', { workspace, name, uuid, uploadId })

  res.status(204).send()
}

function formatUploadId (uuid: string, uploadId: string): string {
  return `${uuid}/${uploadId}`
}

function parseUploadId (value: string): { uuid: string, uploadId: string } {
  const [uuid, uploadId] = value.split('/')
  if (uuid == null || uploadId == null) {
    throw new Error('Invalid upload id')
  }
  return { uuid, uploadId }
}

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Send/derive the upload id exactly as '<uuid>/<uploadId>' as returned by the multipart upload initiation response
  2. Log the raw id value before parsing to spot missing segments or encoding issues
  3. Check for double URL-encoding that corrupts the '/' separator
  4. Align client code with the current multipart API response format after version upgrades

Example fix

// before
const id = uploadIdOnly // 'abc123'
// after
const id = `${uuid}/${uploadId}` // '9f8e.../abc123'
Defensive patterns

Strategy: validation

Validate before calling

function isWellFormedUploadId(id: string): boolean {
  const [uuid, uploadId] = id.split('/')
  return uuid != null && uuid.length > 0 && uploadId != null && uploadId.length > 0
}
if (!isWellFormedUploadId(rawUploadId)) throw new Error(`Malformed upload id: '${rawUploadId}'`)

Type guard

function isUploadId(v: string): v is `${string}/${string}` {
  const [a, b] = v.split('/')
  return a != null && b != null
}

Try / catch

try {
  await datalake.uploadPart(rawId, part)
} catch (err) {
  if (/Invalid upload id/.test(String(err.message))) {
    // re-fetch the upload id from the initiate-upload response
  } else throw err
}

Prevention

When it happens

Trigger: Calling handleMultipartUploadPart, handleMultipartUploadComplete, or handleMultipartUploadAbort with an id string lacking the 'uuid/uploadId' shape — e.g. no slash, empty segments, or only one segment.

Common situations: Client truncates the upload id; URL decoding strips or mangles the '/'; older API versions returned ids in a different format; manual construction of the id string.

Related errors


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