Go Behind the Experience to see how Tecovas brings the West to life with Sanity 🤠 July 18th

Troubleshooting adding a schema to Sanity project

23 replies
Last updated: Jun 3, 2023
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?
Jun 3, 2023, 7:02 PM
Hi Gary!
Sounds like it hasn’t been added to the either a primary schema file or to the
Jun 3, 2023, 7:06 PM
Here’s a project I’m working on:
I organize my schema files by type:

File - sanity.config.ts

export default defineConfig({


schema: {

types: [ ...siteSettings, ...navigation, ...objects, ...documents, ...taxonomies]


Here’s an example of a starter’s sanity.config.ts:

File - sanity.config.ts

export default defineConfig({


//edit schemas in './sanity/schema'



File - schema.ts:

import { SchemaTypeDefinition } from 'sanity'

import post from "./post";

export const schema: { types: SchemaTypeDefinition[] } = {

types: [



Jun 3, 2023, 7:11 PM
Hi Ryan!
think I’m doing the same basic thing you have in your code above but on a smaller scale. I’ll share my files below:
Jun 3, 2023, 7:19 PM
Feel free to post them as a private gist if it’s easier.
Jun 3, 2023, 7:19 PM
export default {
  name: 'pet',
  type: 'document',
  title: 'Pet',
  fields: [
      name: 'name',
      type: 'string',
      title: 'Name'
Jun 3, 2023, 7:20 PM
import pet from './pet'

export const schemaTypes = ['pet']
Jun 3, 2023, 7:20 PM
That’s all I have so far… let me know if you want a screen grab of the errors
Jun 3, 2023, 7:20 PM
They basically say “unnamed_type_index_0”
Jun 3, 2023, 7:22 PM
Do you have this added to your config?
Jun 3, 2023, 7:23 PM
Jun 3, 2023, 7:24 PM
Let’s see that section
Jun 3, 2023, 7:24 PM
One sec…
Jun 3, 2023, 7:24 PM
export default defineConfig({
  name: 'default',
  title: 'indigo-elephant',

  projectId: '3uxw0mxz',
  dataset: 'production',

  plugins: [deskTool(), visionTool(), ...(isDev ? devOnlyPlugins : [])],

  schema: {
    types: [...schemaTypes],
Jun 3, 2023, 7:24 PM
And schemaTypes are imported correctly
Jun 3, 2023, 7:24 PM
also tried:
types: schemaTypes (without destructuring)
Jun 3, 2023, 7:25 PM
One sec.
Jun 3, 2023, 7:26 PM
Try removing the quotes from [‘pet’]
Jun 3, 2023, 7:28 PM
in your index.ts
Jun 3, 2023, 7:29 PM
well that’s embarrassing….
Jun 3, 2023, 7:29 PM
No. That’s everyones everyday with a quote somewhere.
Jun 3, 2023, 7:29 PM
I’m going to check the sanity docs… I could have sworn it was in quotes there also… my pride is at stake here, lol
Jun 3, 2023, 7:30 PM
LMK if it’s in the docs. Glad you are onto the next step:)
Jun 3, 2023, 7:31 PM
Nope, the docs were correct… thanks very much for the help!!
Jun 3, 2023, 7:33 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?