strapi/strapi · warning · ParsingFileError
Wrong format uploaded (accepted formats only: jpeg, jpg, png
Error message
Wrong format uploaded (accepted formats only: jpeg, jpg, png, svg).
What it means
Thrown by parseFileMetadatas when the uploaded file's MIME type is not in ACCEPTED_FORMAT. The error wraps a MessageDescriptor so the admin UI can render a localized message; accepted formats are jpeg/jpg/png/svg per the defaultMessage.
Source
Thrown at packages/core/admin/admin/src/pages/Settings/pages/ApplicationInfo/utils/files.ts:33
interface ImageDimensions {
height: number;
width: number;
}
interface ImageAsset extends ImageDimensions {
ext: string | undefined;
size: number;
name: string;
url: string;
rawFile: File;
}
const parseFileMetadatas = async (file: File): Promise<ImageAsset> => {
const isFormatAuthorized = ACCEPTED_FORMAT.includes(file.type);
if (!isFormatAuthorized) {
throw new ParsingFileError('File format', FILE_FORMAT_ERROR_MESSAGE);
}
const fileDimensions = await new Promise<ImageDimensions>((resolve) => {
const reader = new FileReader();
reader.onload = () => {
const img = new Image();
img.onload = () => {
resolve({ width: img.width, height: img.height });
};
img.src = reader.result as string;
};
reader.readAsDataURL(file);
});
const areDimensionsAuthorized =
fileDimensions.width <= DIMENSION && fileDimensions.height <= DIMENSION;
if (!areDimensionsAuthorized) {View on GitHub (pinned to 4a4101264d)
Solutions
- Convert the asset to png, jpg/jpeg, or svg before uploading.
- If you need webp/gif support, extend ACCEPTED_FORMAT in ./constants and update the defaultMessage.
- Verify the file's actual MIME type (file.type) in the browser devtools before upload.
- Strip any renamed extension so the OS-reported MIME type matches the content.
Example fix
// before const ACCEPTED_FORMAT = ['image/jpeg', 'image/png', 'image/svg+xml']; // after const ACCEPTED_FORMAT = ['image/jpeg', 'image/png', 'image/svg+xml', 'image/webp'];
Defensive patterns
Strategy: validation
Validate before calling
const ACCEPTED_FORMAT = ['image/jpeg', 'image/png', 'image/svg+xml'];
if (!ACCEPTED_FORMAT.includes(file.type)) {
// surface a friendly message to the user before upload
} Type guard
const ACCEPTED_FORMAT = ['image/jpeg', 'image/png', 'image/svg+xml'] as const;
type AcceptedMime = typeof ACCEPTED_FORMAT[number];
function isAcceptedMime(m: string): m is AcceptedMime {
return (ACCEPTED_FORMAT as readonly string[]).includes(m);
} Prevention
- Validate file.type in the upload component and disable submit on rejection.
- Document accepted formats in the upload UI hint text.
- Keep ACCEPTED_FORMAT and the localized error message in sync.
When it happens
Trigger: Uploading a webp, gif, bmp, or heic file to the Application Info customization modal (logo / favicon upload).
Common situations: Designer exports a webp logo; favicon uploaded as .ico; browser reports a generic MIME type because the extension was renamed.
Related errors
- The file uploaded is too large (max dimension: {dimension}x{
- Email already taken
- A user with this email address already exists
- Name already taken
- Name already taken
AI-assisted analysis of strapi/strapi@4a4101264d (2026-08-12).
Data as JSON: /api/errors/00c82a727023cbc6.
Report an issue: GitHub.