{"record":{"id":"f1a23be764d76182","repo":"krisk/Fuse","slug":"missing-name-property-in-key","errorCode":null,"errorMessage":"Missing ${name} property in key","messagePattern":"Missing (.+?) property in key","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/tools/KeyStore.ts","lineNumber":57,"sourceCode":"  }\n}\n\nexport function createKey(key: FuseOptionKey<any>): KeyObject {\n  let path: string[] | null = null\n  let id: string | null = null\n  let src: string | string[] | null = null\n  let weight: number = 1\n  let getFn:\n    | ((obj: any) => ReadonlyArray<string> | string | null | undefined)\n    | null = null\n\n  if (isString(key) || isArray(key)) {\n    src = key\n    path = createKeyPath(key)\n    id = createKeyId(key)\n  } else {\n    if (!hasOwn.call(key, 'name')) {\n      throw new Error(ErrorMsg.MISSING_KEY_PROPERTY('name'))\n    }\n\n    const name = key.name\n    src = name\n\n    if (hasOwn.call(key, 'weight') && key.weight !== undefined) {\n      weight = key.weight\n\n      if (weight <= 0) {\n        throw new Error(ErrorMsg.INVALID_KEY_WEIGHT_VALUE(createKeyId(name)))\n      }\n    }\n\n    path = createKeyPath(name)\n    id = createKeyId(name)\n    getFn = key.getFn ?? null\n  }\n","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/krisk/Fuse/blob/edf2fb608eca0461508d1d71317e6e58309ffada/src/tools/KeyStore.ts#L39-L75","documentation":"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.","triggerScenarios":"Thrown at src/tools/KeyStore.ts:57 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the required 'name' property to the key object, e.g. keys: [{ name: 'author' }]","Use the simpler string or array form instead of an object when no extra options are needed: keys: ['author.title'] or keys: 'author.title'","Check for typos in the property name ('Name', 'path', and 'key' are not accepted — only 'name')"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"edf2fb608eca0461508d1d71317e6e58309ffada","analyzedAt":"2026-09-02T02:46:54.623Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}