{"record":{"id":"213515d849ec8a16","repo":"ReactiveX/rxjs","slug":"list-of-properties-cannot-be-empty","errorCode":null,"errorMessage":"list of properties cannot be empty.","messagePattern":"list of properties cannot be empty\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/rxjs/src/pluck.ts","lineNumber":154,"sourceCode":"  k1: K1,\n  k2: K2,\n  k3: K3,\n  k4: K4,\n  k5: K5,\n  k6: K6\n): Observable<PluckedValue<PluckedValue<PluckedValue<PluckedValue<PluckedValue<PluckedValue<T, K1>, K2>, K3>, K4>, K5>, K6>>;\nfunction pluckOperator<\n  T,\n  K1 extends keyof NonNullable<T>,\n  K2 extends keyof NonNullable<PluckedValue<T, K1>>,\n  K3 extends keyof NonNullable<PluckedValue<PluckedValue<T, K1>, K2>>,\n  K4 extends keyof NonNullable<PluckedValue<PluckedValue<PluckedValue<T, K1>, K2>, K3>>,\n  K5 extends keyof NonNullable<PluckedValue<PluckedValue<PluckedValue<PluckedValue<T, K1>, K2>, K3>, K4>>,\n  K6 extends keyof NonNullable<PluckedValue<PluckedValue<PluckedValue<PluckedValue<PluckedValue<T, K1>, K2>, K3>, K4>, K5>>\n>(this: Observable<T>, k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: PluckKey, ...rest: PluckKey[]): Observable<unknown>;\nfunction pluckOperator<T>(this: Observable<T>, ...properties: PluckKey[]): Observable<unknown> {\n  if (properties.length === 0) {\n    throw new Error('list of properties cannot be empty.');\n  }\n\n  return this[map]((value) => {\n    let current: unknown = value;\n\n    for (const property of properties) {\n      if (current === null || current === undefined) {\n        return undefined;\n      }\n      current = Reflect.get(Object(current), property);\n    }\n\n    return current;\n  });\n}\n\nObservable.prototype[pluck] = pluckOperator;\n","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/ReactiveX/rxjs/blob/54796b38a57e6309f9861e174737479bb3f63f61/packages/rxjs/src/pluck.ts#L136-L172","documentation":"pluck(...properties) requires at least one property key. Calling the pluck Symbol operator with zero arguments throws, because there is no meaningful 'pluck nothing' projection.","triggerScenarios":"observable[pluck]() — typically when properties are spread from an empty array: observable[pluck](...keys) with keys.length === 0.","commonSituations":"Dynamically building a key path from configuration/user input that turns out empty (e.g. path.split('.') on an empty string yields [''], but filter+map steps can yield []), or migration code that forwards optional arguments.","solutions":["Guard before spreading: if (keys.length) obs[pluck](...keys) else obs","Default to identity when no keys: keys.length ? obs[pluck](...keys) : obs","Replace pluck entirely with map(v => v?.a?.b) for static paths (pluck is deprecated in modern RxJS)"],"exampleFix":"// before\nobs[pluck](...pathSegments); // pathSegments = []\n// after\nconst plucked = pathSegments.length ? obs[pluck](...pathSegments) : obs;","handlingStrategy":"validation","validationCode":"if (properties.length === 0) return source; // identity\nsource[pluck](...properties);","typeGuard":"const hasKeys = (keys: PluckKey[]) => keys.length > 0;","tryCatchPattern":null,"preventionTips":["Check array length before spreading into pluck","Prefer map(v => v?.a?.b) over pluck for static paths"],"tags":["pluck","argument-validation","spread","empty-arguments"],"backgroundTag":"empty-argument-list","analyzedSha":"54796b38a57e6309f9861e174737479bb3f63f61","analyzedAt":"2026-08-28T10:21:27.410Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}