Scanner connection failed to open. Err msg (-21345) - This worked for me
i, too, was previously able to scan from my all-in-one printer. but recently (Catalina?) the various methods to access the scanner (Printer & Scanner Setting, Preview, or Image Capture) all returned with that annoying "Failed to open a connection to the device (-21345)" message.
my environment: iMac, late 2013, Catalina 10.15.7, Canon PIXMA TR8500 all-in-1, both on WiFi (different radio bands, but same logical network).
one potentially helpful page was going on about networks and such. for grins, i turned on IPv6 on the "Wi-Fi" connector in Settings -> Network -> WiFi -> (unlock) -> Advanced -> TCP/IP -> Configure IPv6
the scanner suddenly became visible and all is well!
possible down-side? i can't for the life of me figure out how to DISABLE IPv6 again on the WiFi connector ... but that seems OK so far.
i hope this helps someone.
iMac Line (2012 and Later)