{"record":{"id":"097cc0d4ff4ea9b3","repo":"ReactiveX/rxjs","slug":"cannot-install-the-rxjs-create-protocol-create","errorCode":null,"errorMessage":"Cannot install the RxJS create protocol: ${CREATE_SYMBOL_KEY} is already occupied","messagePattern":"Cannot install the RxJS create protocol: (.+?) is already occupied","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/rxjs/src/create.ts","lineNumber":49,"sourceCode":"}\n\nfunction getInstanceCtor(value: any): ObservableCtor {\n  return value.constructor;\n}\n\nfunction getStaticCtor(value: any): ObservableCtor {\n  if (typeof value === 'function') {\n    return value;\n  }\n\n  return Observable;\n}\n\nfunction installCreate(target: object) {\n  const existing = Object.getOwnPropertyDescriptor(target, create);\n  if (existing) {\n    if (typeof existing.value !== 'function') {\n      throw new TypeError(`Cannot install the RxJS create protocol: ${CREATE_SYMBOL_KEY} is already occupied`);\n    }\n    return;\n  }\n\n  Object.defineProperty(target, create, {\n    configurable: true,\n    value: createImpl,\n    writable: true,\n  });\n}\n","sourceCodeStart":31,"sourceCodeEnd":60,"githubUrl":"https://github.com/ReactiveX/rxjs/blob/54796b38a57e6309f9861e174737479bb3f63f61/packages/rxjs/src/create.ts#L31-L60","documentation":"The RxJS create Symbol protocol installs onto an object, but refuses to overwrite a non-function value already stored under the create Symbol key. If the descriptor exists and its value is a function it is treated as already installed (idempotent); otherwise it is a hard error to preserve collision isolation.","triggerScenarios":"Object.defineProperty(target, create, {value: 42}) or storing any non-function under the RxJS create Symbol on an Observable subclass/prototype before installCreate runs; also realm-crossing objects with a clobbered Symbol slot.","commonSituations":"Custom Observable subclasses or patched realms where something assigned a non-function to the create Symbol, or cross-realm objects whose Symbol registry entry got overwritten (e.g. duplicate installs with mismatched Symbol identity).","solutions":["Delete or fix the clobbered descriptor: delete target[create] before installing","Ensure only the official @rxjs create Symbol is used — check for Symbol.for/Symbol key mismatches across duplicate RxJS copies","If the existing value is actually a function, no action is needed — installation is idempotent"],"exampleFix":"// before\nmyProto[create] = {}; // later installCreate(myProto) throws\n// after\nmyProto[create] = undefined; delete myProto[create];\ninstallCreate(myProto);","handlingStrategy":"type-guard","validationCode":"const d = Object.getOwnPropertyDescriptor(target, create);\nif (d && typeof d.value !== 'function') delete target[create];","typeGuard":"const hasInstallableCreate = (target: object) => {\n  const d = Object.getOwnPropertyDescriptor(target, create);\n  return !d || typeof d.value === 'function' || Boolean(d.configurable);\n};","tryCatchPattern":"try { installCreate(proto); } catch (e) {\n  if (e instanceof TypeError && String(e.message).includes('create protocol')) {\n    delete (proto as any)[create]; installCreate(proto);\n  } else throw e;\n}","preventionTips":["Keep the create Symbol slot untouched on subclasses","Verify Symbol identity across RxJS copies (dedupe @rxjs in node_modules)","Treat a function under the Symbol as already-installed and skip"],"tags":["symbol","patching","install","collision-isolation","rxjs-next"],"backgroundTag":"symbol-key-collision","analyzedSha":"54796b38a57e6309f9861e174737479bb3f63f61","analyzedAt":"2026-08-28T10:21:27.410Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}