Skip to main content
HTML Validation

Bad value “” for attribute “type” on element “source”: Expected a MIME type but saw the empty string.

About This HTML Issue

The type attribute on a <source> element must contain a MIME type, so an empty value like type="" is invalid.

A <source> names one candidate file for its parent <video>, <audio> or <picture> element. The optional type attribute gives that file's format, such as video/mp4, audio/mpeg or image/avif, and the browser checks it before downloading anything. A <video> or <audio> element skips any source whose type it knows it cannot play. A <picture> element skips sources with an image type the browser does not support and moves on to the next one, ending at its <img>.

An empty type gives the browser nothing to check, so either write the file's MIME type or remove the attribute. Removing it is fine for <video> and <audio>, which find out the format by fetching the file. Inside <picture>, keep type on any source in a format some browsers can't decode, such as AVIF. Without it, those browsers pick the source anyway and show a broken image. If a template prints type on every source, make it print the attribute only when it has a value.

Check the src too. A link to a page on a video hosting service is not a media file, and no type value will make a <video> element play it. Use the service's <iframe> embed code for those videos.

Invalid example

<video controls>
  <source src="intro.webm" type="">
  <source src="intro.mp4" type="">
</video>

Valid example

<video controls>
  <source src="intro.webm" type="video/webm">
  <source src="intro.mp4" type="video/mp4">
</video>

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
€5 / week

1K Weekly

1,000 monthly checks. Cancel anytime.

Get 1K Weekly →

Join teams across 40+ countries