cube-js/cube · error · Error
Cannot get prototype of ${instanceName}. The '${name}' has b
Error message
Cannot get prototype of ${instanceName}. The '${name}' has been cleaned up and is no longer available. What it means
The `getPrototypeOf` trap of the disposed proxy fires when code reads the prototype of an already-disposed instance (e.g. instanceof checks, Object.getPrototypeOf, or methods that inspect the prototype chain). Cube throws to expose dangling references to cleaned-up objects rather than returning misleading results.
Source
Thrown at packages/cubejs-backend-shared/src/disposedProxy.ts:38
throw new Error(
`Cannot call method on ${instanceName}. ` +
`The '${name}' has been cleaned up and is no longer available.`
);
},
has(_target: object, _prop: string | symbol): never {
throw new Error(
`Cannot check property existence on ${instanceName}. ` +
`The '${name}' has been cleaned up and is no longer available.`
);
},
ownKeys(): never {
throw new Error(
`Cannot enumerate properties on ${instanceName}. ` +
`The '${name}' has been cleaned up and is no longer available.`
);
},
getPrototypeOf(): never {
throw new Error(
`Cannot get prototype of ${instanceName}. ` +
`The '${name}' has been cleaned up and is no longer available.`
);
}
});
}
View on GitHub (pinned to 7d981676b3)
Solutions
- Avoid instanceof/prototype introspection of instances after their owner was disposed.
- Re-acquire a live reference before doing type checks.
- Null out cached references at disposal time and check before introspecting.
Example fix
// before
const driver = server.driverFactory;
server.dispose();
if (driver instanceof PostgresDriver) { driver.release(); }
// after
let driver = server.driverFactory;
server.dispose();
driver = null;
if (driver instanceof PostgresDriver) { driver.release(); } Defensive patterns
Strategy: try-catch
Validate before calling
if (ref == null) {
throw new Error('Reference cleared before instanceof check.');
} Type guard
function isLiveInstance<T extends object>(ref: T | null | undefined): ref is T {
if (ref == null) return false;
try {
void Object.getPrototypeOf(ref); // throws on disposed proxy
return true;
} catch {
return false;
}
} Try / catch
try {
if (ref instanceof DriverClass) ref.release();
} catch (e) {
if (e.message.includes('has been cleaned up')) {
return; // already disposed; nothing to release
}
throw e;
} Prevention
- Run instanceof/type introspection only while the owner is known to be alive.
- Track disposal with your own boolean flag instead of probing the object.
- Null out references at dispose time so guards short-circuit on null.
- Avoid frameworks/introspection helpers operating on torn-down Cube internals.
When it happens
Trigger: Performing `x instanceof DriverClass`, Object.getPrototypeOf(x), or any framework plumbing that inspects the prototype of an instance after its owner's dispose() ran.
Common situations: Type/instanceof checks on cached Cube internals after shutdown; dependency-injection or logging frameworks that introspect object prototypes; hot-reload leaving stale references that later get introspected.
Related errors
- Cannot call method on ${instanceName}. The '${name}' has bee
- Cannot check property existence on ${instanceName}. The '${n
- Cannot enumerate properties on ${instanceName}. The '${name}
- Warehouse is being deleted (current state: ${data.state})
- CubeServer is already listening
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/0e3b6fbd8905b72d.
Report an issue: GitHub.