Index: trunk/test/unit/org/openstreetmap/josm/data/validation/ValidatorCLITest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/validation/ValidatorCLITest.java	(revision 18706)
+++ trunk/test/unit/org/openstreetmap/josm/data/validation/ValidatorCLITest.java	(revision 18714)
@@ -10,4 +10,5 @@
 import java.io.File;
 import java.io.IOException;
+import java.io.OutputStream;
 import java.io.PrintWriter;
 import java.lang.reflect.InvocationTargetException;
@@ -46,4 +47,5 @@
 import org.openstreetmap.josm.io.OsmWriterFactory;
 import org.openstreetmap.josm.spi.lifecycle.Lifecycle;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
 import org.openstreetmap.josm.tools.Logging;
@@ -177,4 +179,26 @@
 
     /**
+     * A non-regression test for #22898: Validator CLI errors out when is run with --load-preferences argument
+     */
+    @Test
+    void testNonRegression22898(final @TempDir Path preferencesLocation) throws IOException {
+        final ValidatorCLI validatorCLI = new ValidatorCLI();
+        final Path preferences = preferencesLocation.resolve("preferences.xml");
+        try (OutputStream fos = Files.newOutputStream(preferences)) {
+            final String pref = "<config>\n" +
+                    "    <preferences operation=\"replace\">\n" +
+                    "        <list key='plugins'>\n" +
+                    "          <entry value='baz'/>\n" +
+                    "        </list>\n" +
+                    "    </preferences>\n" +
+                    "</config>";
+            fos.write(pref.getBytes(StandardCharsets.UTF_8));
+        }
+        validatorCLI.processArguments(new String[]{"--load-preferences=" + preferences,
+                "--input", "resources/styles/standard/elemstyles.mapcss"});
+        assertEquals(Collections.singletonList("baz"), Config.getPref().getList("plugins"));
+    }
+
+    /**
      * Read json objects from a file
      * @param path The file to read
