N
Nuxt2mo ago
tpluscode

Unknown schema vendor

Why am I getting this error when starting nuxt? I have not changed anything about thecontent plugin
8 Replies
kapa.ai
kapa.ai2mo ago
Hi @tpluscode. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The error "Unknown schema vendor" in Nuxt Content typically means that the schema validator you are using in your content.config.ts is not recognized or supported by Nuxt Content. According to the documentation, Nuxt Content supports Zod (v3 and v4) and Valibot out of the box. If you use another validator, or if the required validator is not installed, you may encounter this error. Possible causes: - You are using a schema validator that is not supported (e.g., not Zod or Valibot). - The validator package (e.g., zod, valibot) is not installed in your project. - There is a typo or misconfiguration in your content.config.ts regarding the schema definition. How to fix: 1. Make sure you are using a supported validator (Zod or Valibot). 2. Ensure the validator is installed. For example, for Zod v4:
npm install -D zod

npm install -D zod

For Valibot:
npm install -D valibot @valibot/to-json-schema

npm install -D valibot @valibot/to-json-schema

3. Import the validator directly in your content.config.ts:
import { z } from 'zod' // for Zod v3/v4
// or
import { object, string } from 'valibot'

import { z } from 'zod' // for Zod v3/v4
// or
import { object, string } from 'valibot'

4. If you previously used the z re-export from @nuxt/content, update your imports to use the validator directly, as the re-export is deprecated and will be removed in a future release Docs: Schema Validators. If you have not changed anything, it's possible that a dependency update or a change in how Nuxt Content detects validators is causing the issue. Double-check your package.json and content.config.ts to ensure everything matches the supported setup. If you are still having issues, please provide your content.config.ts and a list of installed packages for further troubleshooting. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@555413648382623754> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
tpluscode
tpluscodeOP2mo ago
@kapa.ai I am using zod 4, imported directly from its package
kapa.ai
kapa.ai2mo ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- If you are using Zod v4 and importing it directly from its package, this is the recommended approach for Nuxt Content collection schemas. Your import should look like this:
import { z } from 'zod/v4'
import { z } from 'zod/v4'
or
import { z } from 'zod'
import { z } from 'zod'
Your content.config.ts should then define the schema using this import, for example:
import { defineContentConfig, defineCollection, property } from '@nuxt/content'
import { z } from 'zod/v4'

export default defineContentConfig({
collections: {
docs: defineCollection({
type: 'page',
source: 'docs/**/*.md',
schema: z.object({
title: z.string(),
description: z.string().optional(),
updatedAt: z.date(),
draft: z.boolean().optional(),
tags: z.array(z.string()).optional(),
hero: z.object({
image: property(z.string()).editor({ input: 'media' }),
caption: z.string().optional()
})
})
})
}
})
import { defineContentConfig, defineCollection, property } from '@nuxt/content'
import { z } from 'zod/v4'

export default defineContentConfig({
collections: {
docs: defineCollection({
type: 'page',
source: 'docs/**/*.md',
schema: z.object({
title: z.string(),
description: z.string().optional(),
updatedAt: z.date(),
draft: z.boolean().optional(),
tags: z.array(z.string()).optional(),
hero: z.object({
image: property(z.string()).editor({ input: 'media' }),
caption: z.string().optional()
})
})
})
}
})
If you are still seeing the "Unknown schema vendor" error, the knowledge sources do not provide a specific reason for this when using Zod v4 correctly. However, they do mention that Nuxt Content auto-detects supported validators that are installed, and that only Zod (v3/v4) and Valibot are supported out of the box. Double-check that: - You have only one version of Zod installed. - You are not mixing imports (e.g., using the deprecated z from @nuxt/content). - Your content.config.ts matches the documented pattern Docs: Schema Validators. If all of these are correct and the error persists, the knowledge sources do not contain enough information to diagnose a deeper issue. In that case, consider checking for issues in your lockfile or node_modules, or consult the Nuxt Content repository for recent changes or open issues regarding schema detection. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@555413648382623754> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
tpluscode
tpluscodeOP2mo ago
I exported the schema from a common module to use for validation in a server route. instead, I export the shape and call z.object() in content.config.ts. this helped @kapa.ai
kapa.ai
kapa.ai2mo ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Yes, your solution aligns with best practices described in the Nuxt Content documentation. Nuxt Content expects the schema in content.config.ts to be a Zod object schema, not a Zod schema shape or a schema imported from another module as a ready-made object. By exporting just the shape (an object of field definitions) and then calling z.object() within content.config.ts, you ensure that Nuxt Content can properly detect and process the schema for type generation, validation, and Studio form generation. This approach is also compatible with how Nuxt Content internally handles schema detection and validation, as shown in the documentation examples:
import { defineContentConfig, defineCollection } from '@nuxt/content'
import { z } from 'zod'

const blogShape = {
title: z.string(),
description: z.string().optional(),
date: z.date(),
// ...other fields
}

export default defineContentConfig({
collections: {
blog: defineCollection({
type: 'page',
source: 'blog/*.md',
schema: z.object(blogShape)
})
}
})
import { defineContentConfig, defineCollection } from '@nuxt/content'
import { z } from 'zod'

const blogShape = {
title: z.string(),
description: z.string().optional(),
date: z.date(),
// ...other fields
}

export default defineContentConfig({
collections: {
blog: defineCollection({
type: 'page',
source: 'blog/*.md',
schema: z.object(blogShape)
})
}
})
This pattern ensures compatibility and avoids issues like "Unknown schema vendor" that can occur if the schema is not constructed as expected by Nuxt Content Docs: Schema Validators. So, your fix is correct and recommended! ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@555413648382623754> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?