krisk/Fuse · error · Error

Missing ${name} property in key

Error message

Missing ${name} property in key

What it means

Thrown by createKey when the key is supplied as an object form ({ name, weight?, getFn? }) but lacks the required 'name' property. String and array key forms never hit this guard; only object keys are validated, since 'name' is the sole field that identifies which document path the key indexes.

Source

Thrown at src/tools/KeyStore.ts:57

  }
}

export function createKey(key: FuseOptionKey<any>): KeyObject {
  let path: string[] | null = null
  let id: string | null = null
  let src: string | string[] | null = null
  let weight: number = 1
  let getFn:
    | ((obj: any) => ReadonlyArray<string> | string | null | undefined)
    | null = null

  if (isString(key) || isArray(key)) {
    src = key
    path = createKeyPath(key)
    id = createKeyId(key)
  } else {
    if (!hasOwn.call(key, 'name')) {
      throw new Error(ErrorMsg.MISSING_KEY_PROPERTY('name'))
    }

    const name = key.name
    src = name

    if (hasOwn.call(key, 'weight') && key.weight !== undefined) {
      weight = key.weight

      if (weight <= 0) {
        throw new Error(ErrorMsg.INVALID_KEY_WEIGHT_VALUE(createKeyId(name)))
      }
    }

    path = createKeyPath(name)
    id = createKeyId(name)
    getFn = key.getFn ?? null
  }

View on GitHub (pinned to edf2fb608e)

Solutions

  1. Add the required 'name' property to the key object, e.g. keys: [{ name: 'author' }]
  2. Use the simpler string or array form instead of an object when no extra options are needed: keys: ['author.title'] or keys: 'author.title'
  3. Check for typos in the property name ('Name', 'path', and 'key' are not accepted — only 'name')
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/tools/KeyStore.ts:57 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of krisk/Fuse@edf2fb608e (2026-09-02). Data as JSON: /api/errors/f1a23be764d76182. Report an issue: GitHub.