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
- 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
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
- 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
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
- Must combine observable instance with an array of observable
- A combineLatest projection requires an array of observable v
- RxJS Next expand does not support a scheduler argument.
- RxJS Next expand options must be an object.
- Scheduler-backed generate is not supported by this Symbol co
AI-assisted analysis of ReactiveX/rxjs@54796b38a5 (2026-08-28).
Data as JSON: /api/errors/097cc0d4ff4ea9b3.
Report an issue: GitHub.