When mailmerging a document, with nested mail merge group which starts inside a table and ends outside the table, a NullReferenceException is thrown: "System.NullReferenceException: 'Object reference not set to an instance of an object.' firstParagraphInTemplate was null."
Workaround: move the group end (EndGroup, TableEnd, RangeEnd, or GroupEnd) merge field inside the table where the group starts.