diff --git a/dnf5/commands/repoquery/repoquery.cpp b/dnf5/commands/repoquery/repoquery.cpp
index 56b3c8d33..3afe22a66 100644
--- a/dnf5/commands/repoquery/repoquery.cpp
+++ b/dnf5/commands/repoquery/repoquery.cpp
@@ -28,6 +28,7 @@ along with libdnf. If not, see .
#include
#include
#include
+#include
#include
#include
@@ -413,6 +414,10 @@ void RepoqueryCommand::configure() {
}
}
}
+ if (exactdeps->get_value() && (whatrequires->get_value().empty() && whatdepends->get_value().empty())) {
+ throw libdnf5::cli::ArgumentParserMissingDependentArgumentError(
+ M_("Option \"--exactdeps\" has to be used either with \"--whatrequires\" or \"--whatdepends\""));
+ }
}
void RepoqueryCommand::load_additional_packages() {