Part of the libbitcoinkernel project (tracking issue #27587 ), specifically the "Remove translation.h usage from the kernel" item. kernel::Notifications::fatalError() and flushError() take a bilingual_str, which pulls util/translation.h and the application-level G_TRANSLATION_FUN into the kernel library, and translation is an application concern rather than a consensus one. The same interface already shows the way out: warningSet() takes a kernel::Warning enum, and the node turns it into a translated string in node/kernel_notifications.cpp.
Along with removing the dependency, another goal here is separating responsibilities, because the goals of error handling and error reporting are different: presenting an error to a user is an application concern, not something libbitcoinkernel itself should own. The error is structured on both sides: in C++ as the full kernel::FatalError variant, and in the C API as its numeric value. With the current changes the C side only carries half of that structure today though, the dynamic fields (a block hash, a path, an exception's what()) do not cross the C API yet, even though ideally they should.
This PR does the same for the two error notifications. A new src/kernel/error.h defines kernel::FlushError as a plain enum and kernel::FatalError as a std::variant with one struct per error, whose fields carry the context the message needs: a block hash, a path, the what() of a caught exception, block heights. It holds types and nothing else, so every message is now built on the node side. The exception is FatalErrorString() in validation.cpp, because a fatal error raised during validation also fails the block through BlockValidationState::Error(), which takes the reason as a plain string right there, and fatalError() returns void, so the node has no way to put its message into that state. A follow-up could store the typed error in the state instead and let the node create the string message.
This does not remove the kernel's dependency on util/translation.h, it is just a step. The other two notifications, progress() and warningSet(), still take a bilingual_str, and bitcoinkernel.cpp, checks.cpp, node/chainstate.cpp, txmempool.cpp and validation.cpp still include the header.
There is one behavior change to mention here. The two C API callbacks lose their message parameter, so they now carry only the error code, the same pattern that btck_BlockValidationResult already uses.