> For AI agents: the complete Sanity documentation index is available at [https://www.sanity.io/docs/llms.txt](https://www.sanity.io/docs/llms.txt).

# Reference options must be an object

Sanity Studio reports that a reference type expects `options` to be an object when the `options` key on a reference is set to anything other than a plain object.

The `reference` field lets you define options for the input component. Define these options under the `options` key, and set its value to an object.

Sanity Studio reports `The reference type expects `options` to be an object` when a reference type has an `options` key whose value is not a plain object. The error fires whenever `options` is set to anything other than a plain object, and only then. An array, a string, a number, and a boolean all trigger it.

## Fix the options value

**schemaTypes/blogPost.ts (incorrect)**

```typescript
import {defineField, defineType} from 'sanity'

export default defineType({
  name: 'blogPost',
  type: 'document',
  fields: [
    defineField({
      name: 'author',
      type: 'reference',
      to: [{type: 'person'}],
      // Fails validation: `options` is an array, not an object
      options: [{filter: 'age > 30'}],
    }),
  ],
})
```

**schemaTypes/blogPost.ts (correct)**

```typescript
import {defineField, defineType} from 'sanity'

export default defineType({
  name: 'blogPost',
  type: 'document',
  fields: [
    defineField({
      name: 'author',
      type: 'reference',
      to: [{type: 'person'}],
      options: {filter: 'age > 30'},
    }),
  ],
})
```

A reference accepts `filter`, `filterParams`, `disableNew`, and `creationTypeFilter` as options. Note that `weak` is a top-level property on the reference definition, not an option. See [Reference type](https://www.sanity.io/docs/studio/reference-type) for the full list.

## Related reference schema errors

- [Reference field options must be nested under the options key](https://www.sanity.io/docs/help/schema-reference-options-nesting): for when `filter` or `filterParams` sits on the root of the type instead of inside `options`.
- [Incompatible combination of params and filter](https://www.sanity.io/docs/help/schema-reference-filter-params-combination): for when `filterParams` is combined with a `filter` function.

