schollz/croc · error
Storage service returned unsupported chunk size ${created.ch
Error message
Storage service returned unsupported chunk size ${created.chunkSize} What it means
After POSTing a new stored transfer, createStoredUpload() verifies the server's declared chunkSize equals the client's storedChunkSize (4 MiB). Chunk encryption (storeSealChunk) binds each chunk to its index and size, so a server with a different chunk size would produce ciphertext the receiving client cannot reassemble; the client aborts immediately instead of uploading garbage.
Source
Thrown at web/src/protocol/stored.ts:440
protocol: storedProtocol,
manifestBytes: plan.manifestJSON.byteLength + 28,
chunkBytes: plan.chunkBytes,
redeemVerifier: base64URL(redeemVerifier),
files: plan.files.length,
plaintextBytes: plan.totalSize,
...(downloads === 1 ? {} : { downloads }),
...(expiresSeconds === 24 * 60 * 60 ? {} : { expiresSeconds }),
}),
});
if (!response.ok) throw await responseError(response);
const created = (await response.json()) as {
id: string;
uploadToken: string;
uploadExpiresAt: string;
chunkSize: number;
};
if (created.chunkSize !== storedChunkSize) {
throw new Error(
`Storage service returned unsupported chunk size ${created.chunkSize}`,
);
}
if (!isCapability(created.uploadToken)) {
throw new Error("Storage service returned an invalid upload capability");
}
const downloadsHeader = response.headers.get("X-Croc-Downloads");
const acceptedDownloads =
downloadsHeader === null ? 1 : Number(downloadsHeader);
if (!Number.isSafeInteger(acceptedDownloads) || acceptedDownloads < 1) {
throw new Error("Storage service returned an invalid download count");
}
if (acceptedDownloads !== downloads) {
throw new Error(
`Storage service created ${acceptedDownloads} downloads instead of ${downloads}`,
);
}
return {View on GitHub (pinned to e25f1bdc04)
Solutions
- Update the storage service and web client to matching versions (both must agree on the 4 MiB chunk size)
- Check settings.storeAPI points at the intended service, not a stale or third-party endpoint
- If you implement the service yourself, echo chunkSize: 4194304 in the create response
Defensive patterns
Strategy: try-catch
Try / catch
try { return await createStoredUpload(...); } catch (e) { if (e instanceof Error && e.message.includes("chunk size")) { alert("Client/server version mismatch — update the app and storage service"); } throw e; } Prevention
- Deploy web client and storage service in lockstep so storedChunkSize (4 MiB) always matches
- Pin storeAPI to the version-matched deployment during rolling upgrades
When it happens
Trigger: The create response JSON has chunkSize !== 4194304 — typically a version skew: an older/newer storage service that chunks differently, or a misconfigured third-party implementation of the /transfers API.
Common situations: Deploying a new web client against an old storeAPI deployment (or vice versa) during a rolling upgrade; pointing storeAPI at an incompatible self-hosted relay.
Related errors
- Storage service returned an invalid upload capability
- Storage service returned an invalid download count
- Storage service created ${acceptedDownloads} downloads inste
- Storage service returned an invalid expiration time
- Storage service returned an invalid remaining-download count
AI-assisted analysis of schollz/croc@e25f1bdc04 (2026-08-15).
Data as JSON: /api/errors/7e7e65db1b68f893.
Report an issue: GitHub.