ReactiveX/rxjs · error · TypeError

Cannot install the RxJS create protocol: ${CREATE_SYMBOL_KEY

Error message

Cannot install the RxJS create protocol: ${CREATE_SYMBOL_KEY} is already occupied

What it means

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.

Source

Thrown at packages/rxjs/src/create.ts:49

}

function getInstanceCtor(value: any): ObservableCtor {
  return value.constructor;
}

function getStaticCtor(value: any): ObservableCtor {
  if (typeof value === 'function') {
    return value;
  }

  return Observable;
}

function installCreate(target: object) {
  const existing = Object.getOwnPropertyDescriptor(target, create);
  if (existing) {
    if (typeof existing.value !== 'function') {
      throw new TypeError(`Cannot install the RxJS create protocol: ${CREATE_SYMBOL_KEY} is already occupied`);
    }
    return;
  }

  Object.defineProperty(target, create, {
    configurable: true,
    value: createImpl,
    writable: true,
  });
}

View on GitHub (pinned to 54796b38a5)

Solutions

  1. Delete or fix the clobbered descriptor: delete target[create] before installing
  2. Ensure only the official @rxjs create Symbol is used — check for Symbol.for/Symbol key mismatches across duplicate RxJS copies
  3. If the existing value is actually a function, no action is needed — installation is idempotent

Example fix

// before
myProto[create] = {}; // later installCreate(myProto) throws
// after
myProto[create] = undefined; delete myProto[create];
installCreate(myProto);
Defensive patterns

Strategy: type-guard

Validate before calling

const d = Object.getOwnPropertyDescriptor(target, create);
if (d && typeof d.value !== 'function') delete target[create];

Type guard

const hasInstallableCreate = (target: object) => {
  const d = Object.getOwnPropertyDescriptor(target, create);
  return !d || typeof d.value === 'function' || Boolean(d.configurable);
};

Try / catch

try { installCreate(proto); } catch (e) {
  if (e instanceof TypeError && String(e.message).includes('create protocol')) {
    delete (proto as any)[create]; installCreate(proto);
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Related errors


AI-assisted analysis of ReactiveX/rxjs@54796b38a5 (2026-08-28). Data as JSON: /api/errors/097cc0d4ff4ea9b3. Report an issue: GitHub.