🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Incorrect options declaration in reference

The reference field allows you to define options for the input component. These options should be defined under the options key and be an object.

If you are encountering this error, it usually means that you've defined an options key which is not an object:

export default {
  name: 'blogPost',
  type: 'document',
  fields: [
    // ... your other schema fields ...
    {
      name: 'author',
      type: 'reference',
      to: [{type: 'person'}],
      
      // INCORRECT
      options: [{some: 'option'}],
      
      // CORRECT
      options: {
        some: 'option'
      }
    }
  ]
}

Was this article helpful?