microsoft/playwright · error · TypeError
Can't install fake timers twice on the same global object.
Error message
Can't install fake timers twice on the same global object.
What it means
Error "Can't install fake timers twice on the same global object." thrown in microsoft/playwright.
Source
Thrown at packages/injected/src/clock.ts:796
const timerId = originals.bound.setTimeout(task, timeout);
return () => originals.bound.clearTimeout(timerId);
},
setInterval: (task: () => void, delay: number) => {
const intervalId = originals.bound.setInterval(task, delay);
return () => originals.bound.clearInterval(intervalId);
},
};
const clock = new ClockController(embedder);
const api = createApi(clock, originals.bound, config.browserName);
return { clock, api, originals: originals.raw };
}
export function install(globalObject: WindowOrWorkerGlobalScope, config: InstallConfig = {}): { clock: ClockController, api: Builtins, originals: Builtins } {
if ((globalObject as any).Date?.isFake) {
// Timers are already faked; this is a problem.
// Make the user reset timers before continuing.
throw new TypeError(`Can't install fake timers twice on the same global object.`);
}
const { clock, api, originals } = createClock(globalObject, config);
const toFake = config.toFake?.length ? config.toFake : Object.keys(originals) as (keyof Builtins)[];
for (const method of toFake) {
if (method === 'Date') {
(globalObject as any).Date = mirrorDateProperties(api.Date, (globalObject as any).Date);
} else if (method === 'Intl') {
(globalObject as any).Intl = api[method]!;
} else if (method === 'AbortSignal') {
(globalObject as any).AbortSignal = api[method]!;
} else if (method === 'performance') {
(globalObject as any).performance = api[method]!;
const kEventTimeStamp = Symbol('playwrightEventTimeStamp');
Object.defineProperty(Event.prototype, 'timeStamp', {
get() {
if (!this[kEventTimeStamp])View on GitHub (pinned to c8fc3bf8d3)
When it happens
Trigger: Thrown at packages/injected/src/clock.ts:796 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of microsoft/playwright@c8fc3bf8d3 (2026-08-12).
Data as JSON: /api/errors/3a8654d0f5de66c0.
Report an issue: GitHub.