FlowiseAI/Flowise · warning · Error

MIME type "${mimetype}" is not supported or does not have a

Error message

MIME type "${mimetype}" is not supported or does not have a valid file extension mapping

What it means

Thrown when mapMimeTypeToExt(mimetype) returns empty — the declared MIME type is not in Flowise's known MIME→extension mapping table. Even though the filename has an extension and the MIME is a non-empty string, Flowise cannot verify the pairing because the MIME type itself is unrecognised, so it rejects by default.

Source

Thrown at packages/components/src/validator.ts:161

    validateFilename(filename)

    if (!mimetype || typeof mimetype !== 'string') {
        throw new Error('Invalid MIME type: MIME type is required and must be a string')
    }

    const normalizedExt = extractFileExtension(filename)

    if (!normalizedExt) {
        // Files without extensions are rejected for security
        throw new Error('File type not allowed: files must have a valid file extension')
    }

    // Get the expected extension from mapMimeTypeToExt (returns extension without dot)
    const expectedExt = mapMimeTypeToExt(mimetype)

    if (!expectedExt) {
        // If mapMimeTypeToExt doesn't recognize the MIME type, it's not supported
        throw new Error(`MIME type "${mimetype}" is not supported or does not have a valid file extension mapping`)
    }

    // Ensure the file extension matches the expected extension for the MIME type
    if (normalizedExt !== expectedExt) {
        throw new Error(
            `MIME type mismatch: file extension "${normalizedExt}" does not match declared MIME type "${mimetype}". Expected: ${expectedExt}`
        )
    }
}

/**
 * Filters an array of MIME type strings to only those allowed for file upload config.
 * Used when sanitizing chatbotConfig.allowedUploadFileTypes to prevent malicious values.
 * @param {string[]} mimeTypes Raw MIME types (e.g. from splitting comma-separated config)
 * @returns {string[]} Only MIME types that pass isAllowedUploadMimeType
 */
export const filterAllowedUploadMimeTypes = (mimeTypes: string[]): string[] => {
    if (!Array.isArray(mimeTypes)) return []

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Check mapMimeTypeToExt for the declared MIME; if absent and the type is legitimately supported, extend the map.
  2. Normalise the MIME before validation (trim + lowercase).
  3. Reject the upload with a 415 Unsupported Media Type for genuinely unsupported types.
  4. Confirm the client sends a standard, mapped MIME (image/png, application/pdf, etc.).

Example fix

// before
const expectedExt = mapMimeTypeToExt(mimetype)
if (!expectedExt) throw new Error(`MIME type "${mimetype}" is not supported ...`)

// after — normalise then map, fall back to extension whitelist
const normalized = mimetype.trim().toLowerCase()
const expectedExt = mapMimeTypeToExt(normalized)
if (!expectedExt) {
  return res.status(415).json({ error: `Unsupported media type: ${normalized}` })
}
Defensive patterns

Strategy: validation

Validate before calling

import { mapMimeTypeToExt } from './utils'
function isMappedMimeType(mime: string): boolean {
  return Boolean(mapMimeTypeToExt(mime.trim().toLowerCase()))
}

Type guard

function isSupportedMimeType(mime: string): boolean {
  return typeof mapMimeTypeToExt(mime.trim().toLowerCase()) === 'string' && mapMimeTypeToExt(mime.trim().toLowerCase()).length > 0
}

Try / catch

const normalized = mimetype.trim().toLowerCase()
if (!isSupportedMimeType(normalized)) {
  throw new Error(`MIME type "${normalized}" is not supported or does not have a valid file extension mapping`)
}

Prevention

When it happens

Trigger: Client declares an exotic MIME (application/x-foo, model/gltf-binary) absent from mapMimeTypeToExt; typo in the MIME (image/jpg vs image/jpeg handled, but 'image/jpeg ' with trailing space is not); a legitimate but unmapped MIME the deployment wants to support.

Common situations: Allowing new file types without updating the MIME map; clients sending vendor-specific MIME types; MIME strings with whitespace/casing that aren't normalised before lookup.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/9a23b092601c0f41. Report an issue: GitHub.