The below line of code logs this error: "Trying to access array offset on value of type bool in /wp-content/plugins/meta-box-aio/vendor/meta-box/meta-box-facetwp-integrator/class-mb-facetwp-integrator.php on line 78".
wp_set_post_terms($att_id, 'a string', 'media-owner', true);
The code does work, the term is attached to an image in this case. I am not sure why the error is logged. The same error is logged numerous times: also for line 89, 119, 124, 130, 138, 146, 152, 160. And then all of these errors again 3 more times. So that's 36 lines of errors in debug.log.
I'm using the code in the pmxi_gallery_image hook, provided by the WP All Import plugin. I'm not sure if that matters.