I wrote an article about one possible pattern which is a concrete realization of your question -- though with more ceremony and complexity since the pathway is fully compiled out if you don't use it (vs a nullable pointer strategy):
> Are libraries typically designed to accept an optional input to store potential errors?
> Are libraries typically designed to accept an optional input to store potential errors?
https://zig.news/ityonemo/sneaky-error-payloads-1aka
if you prefer video form:
https://www.youtube.com/watch?v=aFeqWWJP4LE
The answer is no, libraries are not typically designed with a standardized convention for payload return.