Without access to the document on which you say the error occurs, it is difficult to say what the error on that line might result from. I ran the code on your 'Before' document at MS Office forums (https://www.msofficeforums.com/169070-post20.html), and it worked fine with that.

If your current document is anything like your 'Before' document, the simple reason the '12' in 'clause 12' isn't cross-referenced is that the corresponding Heading 1 list level number is '12.', not '12'. Even if that were not the case, auto cross-referencing just any old '12' would be unreliable at best. Consider, for example, '12 July' and '10/12/2022'...