Prevent path based breadcrumb in theme, or, don't show breadcrumbs for 403/404 responses?
You could add a visibility condition to the breadcrumb block. For 404 there is this module block_in_page_not_found and if you negate the condition the block is displayed on all pages other than 404's:



If you want to exclude 403 pages as well you can extend this module and add a check for

$status-&gt;getStatusCode() == 403


to Drupal\block_in_page_not_found\Plugin\Condition\PageNotFoundRequest::evaluate.

Or use the patch from this issue Allow blocks to be configured to show/hide on 403/404 pages, when it applies again.