Confluence has a long-documented failure mode for table-and-macro plug-ins: a macro that needs to re-render the whole page in order to resolve its own operands can end up rendering itself, which renders itself again, and so on until the request dies with a StackOverflowError. It is not specific to any one add-on – it can happen with any macro whose input depends on “everything else on this page”, and CelesteCS Math macros are exactly that kind of macro, since a formula or a chart can reference any table cell or any other macro’s rendered output anywhere on the page.
This article explains when it happens, how to recognize it, and how to structure your page so it never does.
Why it happens
When a Numerical Expression or Chart macro resolves a table cell or another macro as an operand, and the Outer values source (or, for Chart, the range itself) is set to Page content or points at another page, the plug-in has to ask Confluence to render that page’s content first. If the very macro doing the asking is part of what gets rendered again – for example because its own output is itself inside the range being read, or because two macros on the page reference each other’s output – the render call recurses into itself. Confluence itself keeps growing the stack until it gives up.
How to recognize it
- The page (or just one macro on it) fails to save or fails to preview, with no useful error text – just a blank macro or a generic rendering error.
- The server or Confluence Cloud instance logs show
java.lang.StackOverflowErrorwith a long, repeating stack trace that mentions macro rendering classes. - It reproduces reliably with a single macro alone on an otherwise empty page – it is not an interaction between two unrelated macros.
How to avoid it
- Prefer Macro body as the outer values source when the data the formula needs is already inside the macro’s own body. This is the fastest option anyway, since it never triggers a whole-page re-render.
- If you do need Page content or Other page, make sure the range you reference does not include the Chart or Numerical Expression macro that is doing the referencing. In practice this means: put your source table in one place, and your chart/formula that reads it somewhere else – never wrap the chart inside the same block of content it reads from.
- Avoid chains where macro A’s formula reads macro B’s output and macro B’s formula reads macro A’s output. Even indirect cycles like this recurse just as reliably as a macro reading itself.
We fixed a specific case of this in the Chart macro (both Server/Data Center and Cloud): the page-wide self-render guard that has protected Numerical Expression for years was never extended to cover Chart when it shipped, so a chart whose range needed a full page re-render could recurse into itself with no other macros involved. That guard now covers Chart on both platforms, and a chart configured this way renders normally instead of looping. If you saw this behavior with an older version, updating resolves it; if you still see a stack overflow with the latest version, it is almost certainly one of the cross-referencing patterns above, and restructuring the page as described will fix it.
Try it in your own Confluence: CelesteCS Math for Confluence on the Atlassian Marketplace – free trial for Cloud and Data Center.