Issue rendering .qmd file

Dear all

I've been happily working on a .qmd file, rendering periodically to html.. I then tried to render to docx, and had to tweak some #| label: and #| tbl-cap: to make it work.. However, I then received a long error message (pasted below). I tried to revert back to rendering to html, but get the same error!

What have I done wrong? have I broken my phd thesis?!?! All very odd I was only editing the quarto syntax, not the actual code

Any help gratefully received

Error running filter /private/var/folders/9r/8z0w4fhj62vbj1lb2b__m8gw0000gn/T/AppTranslocation/A995B0A0-5DF6-4183-B74B-4800FA61E17D/d/ attempt to index a nil value (field 'integer index')
stack traceback: in function 'tableCaptionsAndLabels' in function <>
[C]: in ?
[C]: in method 'walk' in function 'run_emulated_filter' in local 'callback' in upvalue 'run_emulated_filter_chain' in function <>
stack traceback: in function 'run_emulated_filter' in local 'callback' in upvalue 'run_emulated_filter_chain' in function <>

This usually means you tried to index an empty array of some sort. This is probably by a typo.
I mean this is probably not a problem with the qmd structure but actually a typo in code.
could 3125 be the number of line? I guess it would be easier if error messages would highlight the error line or even block.