@SuppressWarnings("unchecked")
    private Set<ErrorMessage> flattenErrors(Set<ErrorMessage> errors, Data data) {
        if (data.request() == null) return Set.of(); // Not allowed, but handle anyway
        errors = addTo(errors, data.request().errors());

        if (data instanceof DataList) {
            for (Data item : ((DataList<Data>) data).asList())
                errors = flattenErrors(errors, item);
        }

        return errors;
    }
This sets header and status from special Data items used for the purpose.
Do both at once to avoid traversing the data tree twice.
container-core/src/main/java/com/yahoo/processing/handler/ProcessingResponse.java