Related Items in a Category not Appearing in Results
The code above was missing a space after not

.id('not'~entry.id) should have been .id('not '~entry.id)

This one is an easy one to miss and I have done it a million times.