How to make errors of zeek::protocol_begin non fatal?

I assume you are using the overload of zeek::protocol_begin with a child name to forward to a particular named analyzer,

function zeek::protocol_begin(
    analyzer: optional<string>,
    protocol: spicy::Protocol = spicy::Protocol::TCP);

If your downstream analyzer supports DPD you could instead use the overload forwarding into DPD so a child analyzer is picked based on content.

function zeek::protocol_begin(protocol: spicy::Protocol = spicy::Protocol::TCP);

If the child analyzer does not support DPD (e.g., because you pass additional data to it in band like discsussed in How to push status information from a spicy parser to an cpp parser?), you need to explicitly keep track whether the child analyzer is loaded. You could do that by querying that from the Zeek side and persisting the result, and then access that information from your Spicy code, e.g.,

# e.g., in your parent analyzer's `main.zeek`
const HAS_MY_CHILD_ANALYZER = Analyzer::has_tag("MY_CHILD_ANALYZER");

and then in your Spicy code

global HAS_MY_CHILD_ANALYZER = zeek::get_bool("HAS_MY_CHILD_ANALYZER"); # Semantically const.

...

zeek::protocol_begin(); # Adds DPD as a child analyzer.

...

# Guard at least the forwarding, maybe also the `protocol_begin`.
if (HAS_MY_CHILD_ANALYZER) {
    zeek::protocol_data_in(is_orig, $$); # Forward data to DPD.
}