Joint session with Vercel: How to build intelligent storefronts (May 15th)

Sanity Vision Plugin Error After Working Previously (v3.8.2 & v3.9.1)

3 repliesLast updated: Dec 2, 2025

Im having some issues with the sanity/vision plugin. Today it started showing me this error message, I have used it for a long time before today without problems. Im currently using version
3.8.2
of the plugin, I also tried with the newest version
3.9.1
with no luck.
The plugin is configured like this:

definePlugin({
  plugins: [
    // Plugin for testing GROQ queries
    visionTool(),
  ],
})
AI Update

I can see from your configuration that you're using definePlugin where you should be using defineConfig for your studio configuration file. This is likely why the Vision plugin suddenly stopped working.

The Problem

You're wrapping visionTool() in definePlugin, but definePlugin is for creating custom plugins, not for configuring your studio. Your studio configuration file (sanity.config.js or sanity.config.ts) should use defineConfig instead.

Your current code:

definePlugin({  // ❌ Wrong context
  plugins: [
    visionTool(),
  ],
})

Should be:

defineConfig({  // ✅ Correct
  plugins: [
    visionTool(),
  ],
})

The Correct Setup

Here's how your studio configuration should look:

import {defineConfig} from 'sanity'
import {structureTool} from 'sanity/structure'
import {visionTool} from '@sanity/vision'

export default defineConfig({
  name: 'default',
  title: 'My Studio',
  projectId: 'your-project-id',
  dataset: 'production',
  
  plugins: [
    structureTool(),
    visionTool(),
  ],
  
  schema: {
    types: [/* your schema types */]
  }
})

Understanding the Difference

Why It Stopped Working Today

If this was working before and suddenly broke, check if something changed in your config file. Perhaps during an update or refactor, defineConfig was accidentally changed to definePlugin. Check your version control history to see what changed.

Once you fix the configuration to use defineConfig, both version 3.8.2 and 3.9.1 of the Vision plugin should work normally. The plugin itself is stable—the issue is just that it's not being loaded properly into your studio due to the incorrect configuration wrapper.

Show original thread
3 replies

Was this answer helpful?

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.

Related contributions