Short answer: trace a corrupted ZIP download back to the upload manifest, and publish an expiring link only after the multipart object has the expected parts, byte length, and integrity metadata. A retry should reuse the same part number; an abandoned session should be aborted.
The least complex diagnosis starts at the file the buyer received. Compare its length with the export produced by the marketplace, then walk backward through the download response, the published object, the completion record, and the numbered parts. This order matters because a perfectly valid download can still deliver an already-incomplete object.
That distinction saves time. A ZIP reader reports the symptom; it rarely identifies the missing part.
What should a marketplace verify in a multipart object storage export before a corrupted ZIP download?
For a private user export, the service should keep two identities separate: the upload session and the catalog record that is allowed to produce a download link. The session owns the numbered parts. The catalog record becomes ready only after completion and verification. An upload id by itself is not proof that an object is ready for a customer.
The useful flow is: generate the archive, record its expected byte length, upload numbered chunks in parallel, persist each successful part identifier and size, complete with a sorted manifest, read the resulting object's metadata, and then issue an authorized link with an expiry. The browser should ask for an export id, not submit an arbitrary object key.
Start with evidence.
For one failed download, inspect the source length, the recorded part numbers, the sum of part sizes, the completion input, the final object length, the final checksum when available, and the response's Content-Length, Content-Type, range status, and cache policy. A 206 response can be correct for a range request. A response with stale metadata for a different object is a different failure class.
Trace the download backward from the bytes
There are several boundaries that look alike from a support ticket.
If the ZIP is shorter than the source, compare the expected sequence with the manifest. A list containing parts 1, 2, and 4 is not complete just because its count looks plausible; the final part can also be smaller than the others. If the archive has the expected length but will not open, compare the final bytes or checksum with the producer's output and check that completion used the identifiers returned by storage.
Ordering is easy to get wrong under parallel upload. Arrival order is not part order. Completion should sort by the assigned number and send the exact identifier for each part. Small local tests often miss this because requests finish in a convenient sequence.
Retries need a stable owner. A timeout does not establish whether a part was accepted, so the worker should first consult its persisted manifest or the storage adapter's part listing. Re-sending a known number is appropriate when the adapter replaces that numbered part; appending an untracked chunk creates an ambiguous object. Two workers must not silently turn one export into two catalog records.
The download layer has its own checks. Private responses need an intentional cache policy. Cache-Control: private, max-age=0, must-revalidate is a reasonable starting point when an authorized response should be revalidated, while a stricter policy may fit a link that must never be stored. The right choice depends on the threat model. RFC 3986 also matters when an object key or link contains percent-encoded characters: decode and encode at the correct boundary instead of comparing two different URI representations as if they were the same key.
Make publication a state machine, not a flag
The application state should make an incomplete export impossible to publish accidentally. Keep uploading, ready, and aborted explicit, and make completion conditional on the current session. A repeated completion request should observe one final record, not create a second public state.
Here is the core record and the gate that separates storage work from delivery:
type ExportStatus = "creating" | "uploading" | "ready" | "aborted"; interface ExportRecord { exportId: string; ownerId: string; objectKey: string; status: ExportStatus; expectedBytes: number; uploadedParts: number[]; completedBytes?: number; checksum?: string; } interface ObjectMetadata { size: number; checksum?: string; } function canPublish(record: ExportRecord, object: ObjectMetadata): boolean { return record.status === "uploading" && object.size === record.expectedBytes && (!record.checksum || record.checksum === object.checksum); } function markReady(record: ExportRecord, object: ObjectMetadata): void { if (!canPublish(record, object)) { throw new Error("export does not match its recorded integrity checks"); } record.completedBytes = object.size; record.status = "ready"; } The transition is deliberately boring. That is a feature. Link creation belongs after markReady, authorization, and an object metadata read. If the metadata does not match, retain the export for diagnosis instead of presenting a link that will make a customer's ZIP reader take the blame.
For large marketplace exports, multipart upload earns its complexity through partial retry and throughput. It is not suitable when files are small, a single bounded request is easier to operate, and resumability does not improve the user experience. Stick with that simpler path in those cases; the extra session, manifest, cleanup, and observability work is a real trade-off.
The TypeScript gate between parts and links
The adapter below is intentionally generic. Its methods are application boundaries, not claims about any particular vendor API. That keeps the state machine testable and leaves the storage implementation replaceable.
type Part = { number: number; identifier: string; size: number }; interface MultipartAdapter { putPart(input: { uploadId: string; number: number; body: Uint8Array; }): Promise<{ identifier: string }>; complete(input: { uploadId: string; parts: Part[]; }): Promise<ObjectMetadata>; abort(input: { uploadId: string }): Promise<void>; } async function finishExport( adapter: MultipartAdapter, uploadId: string, chunks: Uint8Array[], record: ExportRecord, ): Promise<ObjectMetadata> { if (record.status !== "uploading") { throw new Error("export session is not open"); } const parts: Part[] = []; for (let index = 0; index < chunks.length; index += 1) { const number = index + 1; const result = await adapter.putPart({ uploadId, number, body: chunks[index], }); parts.push({ number, identifier: result.identifier, size: chunks[index].byteLength, }); } parts.sort((left, right) => left.number - right.number); const object = await adapter.complete({ uploadId, parts }); markReady(record, object); return object; } In production, the parts collection comes from durable session state, not only from the current process. A worker restart must be able to distinguish an accepted part from an unknown outcome. Persisting the identifier and size also gives support a useful answer when a customer reports a broken archive.
Abort is part of the normal lifecycle. A cancelled export, an expired session, or a retry policy that has given up should move the session to aborted and release its multipart state. Cleanup should act only on an open session with the expected upload identity. Never let a broad cleanup job guess which export a part belongs to.
Test the failure you want support to explain
The test matrix should interrupt a middle part, restart the worker, retry that exact number, and compare the resulting bytes with the source archive. Add duplicate completion, a missing part, a wrong identifier, two concurrent workers, an expired link, and a range download. These cases exercise ownership and state transitions, not just the happy path.
Observability should follow the same boundaries. Record the export id, upload id, expected length, part numbers, part sizes, completion result, final length, checksum, expiry, response status, and cache headers. Do not log link query strings or file contents. Alert on old open sessions and final-size mismatches, and retain a support query that exposes the manifest without exposing the export.
I'm not sure a checksum alone can explain why a ZIP failed. It can, however, turn “the archive is broken” into a precise integrity comparison. Your mileage may vary on cache settings because the authorization model changes the acceptable storage behavior.
The decision rule is short: use a single request for small exports with no meaningful resume requirement; use multipart for large files when partial retry and throughput justify durable session state; publish only from a verified terminal transition. No shortcut here.
References
- MDN,
Cache-Controlresponse header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control - RFC 3986, URI Generic Syntax and percent-encoding: https://www.rfc-editor.org/rfc/rfc3986
Further reading
The selected object-storage protocol's official multipart and integrity documentation should be added to an implementation's runbook, because part limits, checksum semantics, and completion behavior vary by implementation.
