Index: trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchCompilerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchCompilerTest.java	(revision 18494)
+++ trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchCompilerTest.java	(revision 18496)
@@ -851,3 +851,12 @@
         assertFalse(c.match(OsmUtils.createPrimitive("node name=bar")));
     }
+
+    /**
+     * Non-regression test for JOSM #22156
+     * x % 0 throws an ArithmeticException
+     */
+    @Test
+    void testNonRegression22156() {
+        assertThrows(SearchParseError.class, () -> SearchCompiler.compile("nth%: 0"));
+    }
 }
