Sanity schema error: "no type or title" despite following tutorial

23 replies
Last updated: Jan 28, 2026
Hi everyone,
I’m following the tutorial on getting my first schema set up, and I copied and pasted the example schema for pet into the schemas folder, but Sanity is telling me I haven’t provided a type or a title…. any thoughts on what I might be doing wrong?
AI Update

Ah, this is a common issue! The problem is likely that you need to export the schema and register it in your Sanity configuration file. Just creating the file in the schemas folder isn't enough - Sanity won't automatically pick it up.

Here's what you need to do:

1. Make sure your schema file exports the type

Your pet schema file should look something like this:

import { defineType, defineField } from 'sanity'

export const pet = defineType({
  name: 'pet',
  type: 'document',
  title: 'Pet',
  fields: [
    defineField({
      name: 'name',
      type: 'string',
      title: 'Name',
    }),
    // other fields...
  ],
})

Notice the export keyword before the schema definition - this is crucial!

2. Import and register it in your sanity.config.ts (or sanity.config.js)

In your main Sanity config file, you need to import your schema and add it to the schema.types array:

import { defineConfig } from 'sanity'
import { pet } from './schemas/pet' // adjust path as needed

export default defineConfig({
  // ... other config
  schema: {
    types: [pet], // Add your schema here
  },
})

If you have an index file in your schemas folder (like schemas/index.ts), you might need to export it from there first:

// schemas/index.ts
export { pet } from './pet'

Then import it in your config:

import { pet } from './schemas'

The error you're seeing happens because Sanity's schema system is looking for registered schema types in your config but can't find yours. The defineType helper provides TypeScript support and autocomplete, but the schema still needs to be properly exported and registered in your config for Sanity to recognize it.

After making these changes, restart your dev server and the error should disappear!

Show original thread
23 replies

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?