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

Incorrect location for reference options

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

If you are encountering this error, it usually means that you've placed options on the root of the reference type instead of in the options object:

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

Was this article helpful?