In case anyone else is following along. We figured this out. Has to do with this edit.
The directories table should only have 1 entry per library_section_id. Op already had a section 16 so this resulted in a duplicate. The fix is not to change this entry but to change all the subsequent entries to reuse the existing section id and to change the parent id for those entries to also point to the same existing section id.