diff --git a/src/frontend/query_commands.ml b/src/frontend/query_commands.ml
index ea83c1d738..98cbf30dd1 100644
--- a/src/frontend/query_commands.ml
+++ b/src/frontend/query_commands.ml
@@ -508,7 +508,7 @@ let dispatch pipeline (type a) : a Query_protocol.t -> a =
               with Not_found -> None
             else None
           )
-        |> List.sort
+        |> List.sort_uniq
           ~cmp:(fun (_,l1) (_,l2) ->
               Lexing.compare_pos l1.Location.loc_start l2.Location.loc_start)
     end
diff --git a/tests/test-dirs/refactor-open/qualify.t b/tests/test-dirs/refactor-open/qualify.t
index 89bb7982d7..5845d328a1 100644
--- a/tests/test-dirs/refactor-open/qualify.t
+++ b/tests/test-dirs/refactor-open/qualify.t
@@ -106,17 +106,6 @@ refactor open qualiafy use short paths - 2
         },
         "content": "L.M.N"
       },
-      {
-        "start": {
-          "line": 9,
-          "col": 5
-        },
-        "end": {
-          "line": 9,
-          "col": 8
-        },
-        "content": "L.M.N"
-      },
       {
         "start": {
           "line": 10,