gitbutlerapp/gitbutler · error
is MB, over the MB upload limit
Error message
${tooLarge.name} is ${(tooLarge.size / (1024 * 1024)).toFixed(1)} MB, over the ${UPLOAD_SIZE_LIMIT / (1024 * 1024)} MB upload limit What it means
Thrown by the useUploadFiles mutation when any file in the array exceeds UPLOAD_SIZE_LIMIT. The mutation validates all files up front via oversizedFile(files) and rejects with a human-readable message naming the offending file, its size in MB, and the limit. This prevents oversized payloads from being sent to the API.
Solutions
- Validate file sizes client-side before invoking the mutation and reject or warn on oversized files.
- Compress or downscale large images before upload.
- Catch the mutation error and show its message (it is already user-friendly) in the upload UI.
Example fix
// before
await uploadFilesMutation.mutateAsync(files);
// after
const tooLarge = files.find(f => f.size > UPLOAD_SIZE_LIMIT);
if (tooLarge) {
toast.error(`${tooLarge.name} exceeds the upload limit`);
return;
}
await uploadFilesMutation.mutateAsync(files); Defensive patterns
Strategy: validation
Validate before calling
const tooLarge = files.find(f => f.size > UPLOAD_SIZE_LIMIT);
if (tooLarge) {
showToast(`${tooLarge.name} exceeds the ${UPLOAD_SIZE_LIMIT / 1024 / 1024} MB limit`);
return;
} Try / catch
try {
await uploadFiles(files);
} catch (e) {
showToast(e instanceof Error ? e.message : 'Upload failed');
} Prevention
- Validate file sizes in the file picker/drop handler before accepting files
- Compress or downscale large images before upload
- Surface the limit in the upload UI up front
When it happens
Trigger: Calling the useUploadFiles mutation with an array containing at least one File whose size > UPLOAD_SIZE_LIMIT (the configured MB limit, compared in oversizedFile).
Common situations: User attaches a large image/video/log via chat/file-drop UI; paste of a large screenshot; batch upload where one file among many is oversized.
Understand the failure class
Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.
Related errors
- is MB, over the MB upload limit
- Aborting due to empty branch name
- Aborting due to empty
- API returned version
- At least one review number is required
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/6be27813670cf94e.
Report an issue: GitHub.
Appendix: source
Thrown at apps/lite/ui/src/api/mutations.ts:304
return splitGeneratedDescription(response);
},
meta: { failureTitle: "Failed to generate description" },
});
};
/**
* Upload files and return them in the order given, so the markdown they turn
* into matches the order they were picked or dropped in.
*
* One failure fails the batch: a body half-linking a set of screenshots is
* worse than one the user retries.
*/
export const useUploadFiles = () =>
useMutation({
mutationFn: async (files: Array<File>) => {
const tooLarge = oversizedFile(files);
if (tooLarge !== undefined) {
throw new Error(
`${tooLarge.name} is ${(tooLarge.size / (1024 * 1024)).toFixed(1)} MB, over the ${
UPLOAD_SIZE_LIMIT / (1024 * 1024)
} MB upload limit`,
);
}
return Promise.all(
files.map(async (file) =>
window.lite.uploadFile({
filename: file.name,
content_type: file.type === "" ? null : file.type,
data_base64: await toBase64(file),
}),
),
);
},
meta: { failureTitle: "Failed to upload files" },
});
View on GitHub (pinned to 58e5313667)