Intervention/image · error · Intervention\Image\Exceptions\NotSupportedException

Unable to retrieve unsupported media type from format

Error message

Unable to retrieve unsupported media type from format

What it means

Error "Unable to retrieve unsupported media type from format" thrown in Intervention/image.

Source

Thrown at src/Format.php:111

        return array_filter(
            MediaType::cases(),
            fn(MediaType $mediaType): bool => $mediaType->format() === $this,
        );
    }

    /**
     * Return the first found media type for the current format.
     *
     * @throws NotSupportedException
     */
    public function mediaType(): MediaType
    {
        $types = $this->mediaTypes();

        $result = reset($types);

        if (!$result instanceof MediaType) {
            throw new NotSupportedException('Unable to retrieve unsupported media type from format');
        }

        return $result;
    }

    /**
     * Return the possible file extension for the current format.
     *
     * @return array<FileExtension>
     */
    public function fileExtensions(): array
    {
        return array_filter(
            FileExtension::cases(),
            fn(FileExtension $fileExtension): bool => $fileExtension->format() === $this,
        );
    }

View on GitHub (pinned to 5598b9e397)

Solutions

  1. Query mediaType() only on formats that define one; check the Format cases supported by your library version
  2. Use Format::mediaTypes()/fileExtensions() helpers to inspect what a given format supports before calling
  3. Upgrade the library if the format is listed in a newer version's media type map

When it happens

Trigger: Thrown at src/Format.php:111 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Intervention/image@5598b9e397 (2026-08-23). Data as JSON: /api/errors/f96daba0824095cd. Report an issue: GitHub.