diff --git a/ffprobe.c b/ffprobe.c
index 77c343a96aa49ac8ee8a13bdce5e2dc5e2948980..34626a8fc9e9fd8cb0ef77b8216ea263056e33f2 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -926,6 +926,7 @@ static av_cold int xml_init(WriterContext *wctx, const char *args, void *opaque)
             av_log(wctx, AV_LOG_ERROR,                                  \
                    "XSD-compliant output selected but option '%s' was selected, XML output may be non-compliant.\n" \
                    "You need to disable such option with '-no%s'\n", opt_name, opt_name); \
+            return AVERROR(EINVAL);                                     \
         }
         CHECK_COMPLIANCE(show_private_data, "private");
         CHECK_COMPLIANCE(show_value_unit,   "unit");