hcengineering/platform · warning
invalid upload id
Error message
invalid upload id
What it means
handleMultipartUploadPart expects an uploadId query parameter that parses into a workspace uuid plus internal uploadId via parseUploadId. If parsing throws (malformed or absent query param), the handler responds 400 'invalid upload id'. The id must come from a prior multipart-init response.
Source
Thrown at services/datalake/pod-datalake/src/handlers/multipart.ts:76
}
export async function handleMultipartUploadPart (
ctx: MeasureContext,
req: Request,
res: Response,
datalake: Datalake
): Promise<void> {
const workspace = req.params.workspace as WorkspaceUuid
const partNumber = req.query.partNumber as string
let uuid: string
let uploadId: string
const upload = req.query.uploadId as string
try {
;({ uuid, uploadId } = parseUploadId(upload))
} catch (err: any) {
res.status(400).send('invalid upload id')
return
}
if (!req.readable) {
res.status(400).send('missing body')
return
}
const { bucket } = await datalake.selectStorage(ctx, workspace)
const part = await bucket.uploadMultipartPart(ctx, uuid, { uploadId }, req, {
size: Number.parseInt(req.headers['content-length'] ?? '0'),
partNumber: Number.parseInt(partNumber)
})
ctx.info('multipart-part', { workspace, uuid, uploadId, partNumber })
res.status(200).json(part)View on GitHub (pinned to 63e28dc964)
Solutions
- Pass the exact uploadId string returned by the multipart-init endpoint as the uploadId query parameter.
- Ensure the uploadId belongs to the same workspace as the request path.
- Reinitialize the multipart upload if the original id was lost or the server restarted.
Example fix
// before
fetch(`${base}/${ws}/multipart/${name}/part?uploadId=abc`)
// after
const { uploadId } = await initMultipart(ws, name)
fetch(`${base}/${ws}/multipart/${name}/part?uploadId=${encodeURIComponent(uploadId)}`) Defensive patterns
Strategy: validation
Validate before calling
if (!uploadId || typeof uploadId !== 'string') {
throw new Error('uploadId from multipart-init is required')
} Type guard
function isUploadId(v: unknown): v is string {
return typeof v === 'string' && v.length > 0
} Try / catch
const res = await fetch(partUrl, opts)
if (res.status === 400 && (await res.text()) === 'invalid upload id') {
// re-init multipart upload and retry with fresh id
const init = await initMultipart(ws, name)
return uploadPart(init.uploadId, part)
} Prevention
- Always take uploadId verbatim from the init response; never construct it manually.
- Keep the id associated with its workspace and upload session.
- Re-init the upload after server restarts or unknown-id errors.
When it happens
Trigger: Calling the multipart part-upload endpoint with ?uploadId missing, empty, or a value that was never issued by multipart-init (or from another workspace/instance), so parseUploadId throws.
Common situations: Hand-constructed URLs guessing the uploadId format; reusing an uploadId after server restart when it was kept only in memory; copying an id between workspaces.
Related errors
- 'event' or 'workspace' or 'type' is missing
- missing files
- missing body
- missing filename
- Failed to initialize multipart upload
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/aaa8a4072c28bd07.
Report an issue: GitHub.