Unknown type: mux.video error when installing Mux plugin

7 replies
Last updated: Aug 21, 2024
Hi, I'm trying to install Mux following Mux's own documentation. But when getting to step 3 where I should get the "Mux credentials" pop up, I only get an error telling me that
Unknown type: mux.video
. Har anyone had experience with this?
AI Update

The "Unknown type: mux.video" error happens because the Mux plugin hasn't been properly registered in your Sanity Studio configuration. This is a common issue when following Mux's documentation, as they don't clearly mention this crucial step that's specific to how Sanity plugins work.

Here's what you need to do:

1. Install the plugin package (you've probably already done this):

npm install sanity-plugin-mux-input

2. Register the plugin in your sanity.config.ts (or .js)

This is the critical step that's missing. You need to import and add the plugin to your config:

import {defineConfig} from 'sanity'
import {muxInput} from 'sanity-plugin-mux-input'

export default defineConfig({
  // ... your other config options
  plugins: [
    muxInput(), // Add this line
    // ... your other plugins
  ],
})

3. Now you can use the mux.video type in your schema

export default {
  name: 'movie',
  type: 'document',
  fields: [
    {
      name: 'video',
      type: 'mux.video', // This will now be recognized
    }
  ]
}

4. Restart your dev server

Stop your Sanity Studio dev server completely and restart it for the changes to take effect.

Once you've registered the plugin in sanity.config.ts, Sanity will recognize the mux.video type and you'll be able to see the Mux credentials popup when you try to upload a video.

The confusion here is that Mux's own documentation assumes you know how Sanity plugins work, but if this is your first plugin, it's not obvious that every plugin needs to be registered in the config file. You can find the correct installation steps in Sanity's plugin documentation.

Show original thread
7 replies
Have you configured the plugin in your
sanity.config
?
No, I didn’t see anything about sanity.config in the docs I read 🤔
This is the one I followed: https://docs.mux.com/integrations/sanity
(it seems I'm logged in with two different users on my PC and phone, will try and fix that 🙂
Ok, found the sanity.config mentioned in Sanitys documentation (https://www.sanity.io/plugins/sanity-plugin-mux-input ). It wasn't mentioned in Mux's docs (https://docs.mux.com/integrations/sanity ). But I guess it shouldn't be necessary since that is how one installs plugins in Sanity I guess. First plugin for me so didn't know 😮
Great news! Strange that Mux didn’t include that in their documentation, though.
Yes, strange. Informed them about it, perhaps they'll update the docs

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?