The resize loop, frame by frame
You will fire the real "ResizeObserver loop completed with undelivered notifications" error in your own browser, see which frame every notification lands in, and learn which fixes stop the loop and which only silence it.
What the message means
The message means exactly this: a ResizeObserver callback changed the size of an element that a resize observer watches, so the browser could not deliver every notification before painting the frame. It pushes the leftover notifications to the next frame and reports the deferral as an error event on window. Nothing crashed and nothing was lost — but if the message appears on every frame, your callback is running a layout loop before every paint.
It is not a thrown exception. The ResizeObserver spec tells browsers to fire an ErrorEvent with the message “ResizeObserver loop completed with undelivered notifications.” and report it like an uncaught error, which is why it shows up red in the console with no stack that points at your callback. The exact wording varies a little by browser and version — older Chromium builds said “ResizeObserver loop limit exceeded” — so the demo below prints the exact string your browser sends. Your script keeps running either way.
idle · box starts at 150pxPress Adjust once: the box grows by 14px inside its own callback, one error fires, and the leftover notification lands in the next frame. Press Oscillate: the callback keeps writing 90px or 190px, every frame ends with leftovers, and the error fires on every frame until this page’s own cap stops the run.
That is the whole bug in one panel: a log line per callback with the frame number, the callback count and the size the callback saw, and the error event caught with a real listener. The five lines that cause it look almost reasonable:
</> The smallest possible resize loop.Show code
const box = document.querySelector('.box');\nnew ResizeObserver(() => {\n // writes the size it observes: a loop\n box.style.width = box.offsetWidth > 140 ? '90px' : '190px';\n}).observe(box);While any demo here is running, your browser’s console also prints the raw messages. That is the real bug running, not a decoration. Every loop on this page is capped and stops on its own.
It all happens before paint
A ResizeObserver callback never runs in your script’s turn. The browser delivers notifications inside its rendering update, after animation frame callbacks and before paint. By the time your callback runs, layout is clean. The moment it writes a width, the browser has to recalculate style and layout again — just to find out who else changed, and whether anyone still needs notifying.
press RunRun changes the box’s width inside a requestAnimationFrame callback. Watch the frame numbers: the rAF, the observer callback and the error event carry the same number, so all three happened inside one rendering pass, before anything painted. The final callback, one frame later, is the deferred delivery.
One level deeper. The delivery step is a loop of its own: gather every observation whose target’s size changed, deliver them, recalculate layout, gather again. The loop is guaranteed to end because a DOM tree has finite depth. When it ends with skipped observations still pending, the browser fires the error event and keeps those observations for the next frame. That is also why the error has no useful stack trace: it reports the state of a rendering pass, not an exception thrown from your code.
The delivery model is the same family as what IntersectionObserver sees: observers report during the rendering update, not at the moment you call observe(). Calling observe() only marks a target; the first callback arrives at the next rendering pass.
The depth rule
Why not just keep delivering until things go quiet? Because a callback that resizes its own target would spin forever. So the spec has a rule: after each pass, only elements strictly deeper in the DOM tree than the shallowest element just delivered can be notified in the same frame. Everything else — the element you wrote to, its ancestors, its siblings — waits for the next frame, and that deferral is exactly what the error announces.
pick what the .box callback writes to.box’s callback writes to one element, once. Choose Write child and the kid’s second callback arrives with the same frame number and no error — the loop was allowed to descend. Choose self, parent or sibling, and the affected element shows up one frame later with an error event in between.
Frame numbers come from a rAF counter that ticks once per frame; if your browser ordered things differently the labels would shift by one, but the grouping — same frame or next frame — is what the rule controls. Read the outcome as a design tool: a same-frame cascade is only possible downward. “Observe the outer element, write the inner one” works because the written element is never observed at all, while “write to a sibling I also observe” can never settle inside one frame.
One-off or endless
Now the judgement call, and it is a count, not a vibe. If the pattern is one callback, one error, one quiet callback, then silence — that is a single deferral. It is harmless, though still worth fixing if it is your own widget. If the error fires on every frame, layout is being recalculated before every paint: wasted work on every device, visible jank on slow ones, and often a visible flicker, because the intermediate sizes really do paint.
press Record, then step through the framesRecord runs the oscillation for eight frames and freezes the result; nothing here plays by itself. The first callback sees the starting 150px and writes 90px, so the recording opens at 90px. Step through it and you are watching the flicker an endless loop puts on screen: 90px, then 190px, then 90px, one error event per frame.
How to read the message. One error right after a self-adjusting widget mounts is a deferral. The same error on every frame is a loop. Only the second one is on fire.
On a 60Hz display, an endless loop means roughly one forced layout per frame, dozens per second, for as long as the page is open. The demo caps at eight frames because letting it run would only heat the room.
The fixes, measured
There are four honest moves. Stop writing the observed size: observe the outer container, write the inner content, so the observer only ever sees outside-driven changes. Observe a different box: observe() defaults to the content box, and observe(el, { box: 'border-box' }) is stable when your callback adjusts padding or inner chrome. Guard with an expected size: remember what you wrote and ignore the delivery that matches it. Defer with requestAnimationFrame: move the write out of the delivery window. The bench runs the same oscillating bug under each strategy and counts callbacks, error events and frames until the size settles.
click a strategy to run itEvery run stops itself: a 1.4s cap, in case a strategy never settles. A run only counts as settled after a short quiet window with no callbacks; the frames and settled columns report the frame of that last callback, not the later moment the quiet timer confirmed it. “Never (capped)” in the last column is the result that matters.
The guard is the one worth memorizing, because it survives contact with code you cannot restructure:
</> The expected-size guard, tested above.Show code
let written = 0;\nconst ro = new ResizeObserver(([entry]) => {\n const now = entry.contentRect.width;\n if (Math.abs(now - written) < 0.5) return; // our own write landed\n written = computeTarget(now);\n box.style.width = written + 'px';\n});\nro.observe(box);In the bench the numbers tell the story. No fix and rAF defer both run to the cap and never settle; the guard settles in frame two with two callbacks and the single harmless error; the restructure is the only version with zero errors, because nothing it writes is ever observed. Note the rAF row carefully: zero errors, still looping.
One level deeper. The deferred write lands after the delivery loop has closed, so nothing is “skipped” and no error is reported; the next frame’s gather still sees the new size and calls you again. You get one forced layout per frame and a silent loop — the message disappeared, the work did not. This is also where rAF firing exactly once per frame matters: the loop costs one callback per frame for as long as it runs.
One more exit worth taking: if you are resizing an element because its container changed, container queries do that in CSS with no observer, no callback and no loop.
Whose loop is it?
Before you fix anything, find the owner. In rough order of likelihood: your own widget sizing itself from its content; a dependency that does the same — virtualized lists, data grids, rich text editors, chart libraries are the usual suspects; an ad or embed iframe feeding sizes back; and browser extensions that inject toolbars, the classic “broken on my machine, fine for everyone else”. To isolate it, run the page in a private window with extensions off, then disable your own observers in halves. A temporary observer that logs entry.target tells you which element is churning; the error event itself cannot, because it carries no target and no stack.
Sometimes the owner is a dependency you cannot patch, the loop provably settles after one frame, and the red line in the console is the only symptom. Then you can filter it — with your eyes open:
</> A scoped, last-resort filter.Show code
// Only after you have watched the loop settle:\nwindow.addEventListener('error', e => {\n if (e.message && e.message.startsWith('ResizeObserver loop')) {\n e.preventDefault(); // stops the reporting, not the loop\n }\n});press Run the capped loopRun it once with the switch off, then on. Cancelling the events changes what gets reported — check your console — but watch the callback counter: it climbs to the cap either way. The loop never noticed.
Check for extensions first. If the error appears only on one developer’s machine, test in a clean browser profile before touching any code. Injected sidebars and password managers resize the page after load and set off observers that are perfectly healthy.
Practical advice, then. Use ResizeObserver to read a size and write somewhere else — a canvas, an inner element, a data attribute — and add the expected-size guard whenever you must write near what you observe. Accept the single one-off error after a widget mounts; it is a deferral, not a bug in your logic. Fix the loop the moment the message repeats every frame, and prefer the restructure over the rAF defer, because a quiet console is not a fix. And when the sizing you want is a pure function of a container’s width, skip the observer entirely and let container queries do it without JavaScript.
Quick answers
What does "ResizeObserver loop completed with undelivered notifications" mean?
It means a ResizeObserver callback changed the size of an element a resize observer watches, so the browser could not deliver every notification before painting the frame. Leftover notifications are pushed to the next frame and the deferral is reported as an ErrorEvent on window. Nothing crashed and nothing was lost; it is a reported deferral, not a thrown exception.
Should I ignore the ResizeObserver loop error?
If the pattern is one callback, one error, one quiet callback, then silence, it is a single deferral and harmless. If the error fires on every frame, your callback is recalculating layout before every paint, wasting work on every device and causing jank or visible flicker on slow ones. Only the repeating loop is on fire.
How do I fix the ResizeObserver loop error?
Four honest fixes: stop writing the observed size (observe the outer container, write the inner content); observe a different box, such as observe(el, { box: 'border-box' }) when adjusting padding; guard with an expected size so your own write is ignored; or defer the write with requestAnimationFrame. Note the rAF defer hides the message but can keep a silent loop running, so prefer the guard or restructure.
Why does the ResizeObserver loop error have no stack trace?
Because it is not an exception thrown from your code. It reports the state of the browser's rendering pass: notifications are delivered after animation frame callbacks and before paint, and when the delivery loop closes with observations still pending, the browser fires the error event. It carries no target and no stack, so log entry.target from your own observer to find the element.
Can a browser extension cause the ResizeObserver loop error?
Sometimes. Injected toolbars and password managers resize the page after load and set off observers that are perfectly healthy. If the error appears on only one developer's machine, test in a private window or clean browser profile before touching code. Other common owners: self-sizing widgets, virtualized lists, grids, rich text editors, chart libraries and ad iframes.