{"record":{"id":"015b95dc439e33cd","repo":"ReactiveX/rxjs","slug":"invalid-notification-missing-kind","errorCode":null,"errorMessage":"Invalid notification, missing \"kind\"","messagePattern":"Invalid notification, missing \"kind\"","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/rxjs/src/notification.ts","lineNumber":105,"sourceCode":"\n  static createComplete<T = never>(): Notification<T> & CompleteNotification {\n    return Notification.completeNotification as unknown as Notification<T> & CompleteNotification;\n  }\n}\n\nexport const COMPLETE_NOTIFICATION: CompleteNotification = Object.freeze({ kind: 'C' });\n\nexport function nextNotification<T>(value: T): NextNotification<T> {\n  return { kind: 'N', value };\n}\n\nexport function errorNotification(error: any): ErrorNotification {\n  return { kind: 'E', error };\n}\n\nexport function observeNotification<T>(notification: ObservableNotification<T>, observer: Partial<Observer<T>>): void {\n  if (typeof (notification as { kind?: unknown }).kind !== 'string') {\n    throw new TypeError('Invalid notification, missing \"kind\"');\n  }\n\n  if (notification.kind === 'N') {\n    observer.next?.(notification.value);\n  } else if (notification.kind === 'E') {\n    observer.error?.(notification.error);\n  } else {\n    observer.complete?.();\n  }\n}\n","sourceCodeStart":87,"sourceCodeEnd":116,"githubUrl":"https://github.com/ReactiveX/rxjs/blob/54796b38a57e6309f9861e174737479bb3f63f61/packages/rxjs/src/notification.ts#L87-L116","documentation":"observeNotification dispatches a notification to an observer based on its kind field. If notification.kind is not a string (missing, undefined, number), the notification is malformed and a TypeError is thrown before any observer method is called.","triggerScenarios":"observeNotification({}, observer), observeNotification(null?.valueOf(), observer) via the observe operator, or a materialize/serialize round-trip that dropped the kind field.","commonSituations":"Feeding arbitrary objects into the observe operator, or bugs in custom notification producers (e.g. renaming kind during transport or destructuring without the kind property).","solutions":["Validate kind is one of 'N'/'E'/'C' (a string) before calling observeNotification/observe","Reconstruct notifications with nextNotification/errorNotification/completeNotification","Fix the producer that dropped the kind field (check destructuring/serialization)"],"exampleFix":"// before\nobs[observe]({ value: 1 }); // missing kind -> throws\n// after\nobs[observe]({ kind: 'N', value: 1 });","handlingStrategy":"type-guard","validationCode":"if (typeof (notification as any)?.kind !== 'string') throw new TypeError('notification missing kind');\nobserveNotification(notification, observer);","typeGuard":"const hasStringKind = (n: unknown): n is ObservableNotification<any> =>\n  typeof (n as { kind?: unknown })?.kind === 'string';","tryCatchPattern":null,"preventionTips":["Validate kind before dispatching","Never feed arbitrary/partial objects to the observe operator","Use materialize/observeNotification round-trips with typed values"],"tags":["notification","observe","validation","materialize"],"backgroundTag":"invalid-notification-kind","analyzedSha":"54796b38a57e6309f9861e174737479bb3f63f61","analyzedAt":"2026-08-28T10:21:27.410Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}