---
source: crates/ruff_linter/src/rules/pyflakes/mod.rs
---
F601 Dictionary key literal `"a"` repeated
 --> F601.py:3:5
  |
1 | x = {
2 |     "a": 1,
3 |     "a": 2,
  |     ^^^
4 |     "b": 3,
5 |     ("a", "b"): 3,
  |
help: Remove repeated key literal `"a"`

F601 Dictionary key literal `("a", "b")` repeated
 --> F601.py:6:5
  |
4 |     "b": 3,
5 |     ("a", "b"): 3,
6 |     ("a", "b"): 4,
  |     ^^^^^^^^^^
7 |     1.0: 2,
8 |     1: 0,
  |
help: Remove repeated key literal `("a", "b")`

F601 Dictionary key literal `1` repeated (`1` hashes to the same value as `1.0`)
  --> F601.py:8:5
   |
 6 |     ("a", "b"): 4,
 7 |     1.0: 2,
 8 |     1: 0,
   |     ^
 9 |     1: 3,
10 |     b"123": 1,
   |
help: Remove repeated key literal `1`

F601 Dictionary key literal `1` repeated (`1` hashes to the same value as `1.0`)
  --> F601.py:9:5
   |
 7 |     1.0: 2,
 8 |     1: 0,
 9 |     1: 3,
   |     ^
10 |     b"123": 1,
11 |     b"123": 4,
   |
help: Remove repeated key literal `1`

F601 Dictionary key literal `b"123"` repeated
  --> F601.py:11:5
   |
 9 |     1: 3,
10 |     b"123": 1,
11 |     b"123": 4,
   |     ^^^^^^
12 | }
   |
help: Remove repeated key literal `b"123"`

F601 Dictionary key literal `"a"` repeated
  --> F601.py:16:5
   |
14 | x = {
15 |     "a": 1,
16 |     "a": 2,
   |     ^^^
17 |     "a": 3,
18 |     "a": 3,
   |
help: Remove repeated key literal `"a"`

F601 Dictionary key literal `"a"` repeated
  --> F601.py:17:5
   |
15 |     "a": 1,
16 |     "a": 2,
17 |     "a": 3,
   |     ^^^
18 |     "a": 3,
19 | }
   |
help: Remove repeated key literal `"a"`

F601 [*] Dictionary key literal `"a"` repeated
  --> F601.py:18:5
   |
16 |     "a": 2,
17 |     "a": 3,
18 |     "a": 3,
   |     ^^^
19 | }
   |
help: Remove repeated key literal `"a"`
   |
17 |     "a": 3,
   -     "a": 3,
18 | }
   |
note: This is an unsafe fix and may change runtime behavior

F601 Dictionary key literal `"a"` repeated
  --> F601.py:23:5
   |
21 | x = {
22 |     "a": 1,
23 |     "a": 2,
   |     ^^^
24 |     "a": 3,
25 |     "a": 3,
   |
help: Remove repeated key literal `"a"`

F601 Dictionary key literal `"a"` repeated
  --> F601.py:24:5
   |
22 |     "a": 1,
23 |     "a": 2,
24 |     "a": 3,
   |     ^^^
25 |     "a": 3,
26 |     "a": 4,
   |
help: Remove repeated key literal `"a"`

F601 [*] Dictionary key literal `"a"` repeated
  --> F601.py:25:5
   |
23 |     "a": 2,
24 |     "a": 3,
25 |     "a": 3,
   |     ^^^
26 |     "a": 4,
27 | }
   |
help: Remove repeated key literal `"a"`
   |
24 |     "a": 3,
   -     "a": 3,
25 |     "a": 4,
   |
note: This is an unsafe fix and may change runtime behavior

F601 Dictionary key literal `"a"` repeated
  --> F601.py:26:5
   |
24 |     "a": 3,
25 |     "a": 3,
26 |     "a": 4,
   |     ^^^
27 | }
   |
help: Remove repeated key literal `"a"`

F601 [*] Dictionary key literal `"a"` repeated
  --> F601.py:31:5
   |
29 | x = {
30 |     "a": 1,
31 |     "a": 1,
   |     ^^^
32 |     "a": 2,
33 |     "a": 3,
   |
help: Remove repeated key literal `"a"`
   |
30 |     "a": 1,
   -     "a": 1,
31 |     "a": 2,
   |
note: This is an unsafe fix and may change runtime behavior

F601 Dictionary key literal `"a"` repeated
  --> F601.py:32:5
   |
30 |     "a": 1,
31 |     "a": 1,
32 |     "a": 2,
   |     ^^^
33 |     "a": 3,
34 |     "a": 4,
   |
help: Remove repeated key literal `"a"`

F601 Dictionary key literal `"a"` repeated
  --> F601.py:33:5
   |
31 |     "a": 1,
32 |     "a": 2,
33 |     "a": 3,
   |     ^^^
34 |     "a": 4,
35 | }
   |
help: Remove repeated key literal `"a"`

F601 Dictionary key literal `"a"` repeated
  --> F601.py:34:5
   |
32 |     "a": 2,
33 |     "a": 3,
34 |     "a": 4,
   |     ^^^
35 | }
   |
help: Remove repeated key literal `"a"`

F601 Dictionary key literal `"a"` repeated
  --> F601.py:41:5
   |
39 |     "a": 1,
40 |     a: 1,
41 |     "a": 2,
   |     ^^^
42 |     a: 2,
43 |     "a": 3,
   |
help: Remove repeated key literal `"a"`

F601 Dictionary key literal `"a"` repeated
  --> F601.py:43:5
   |
41 |     "a": 2,
42 |     a: 2,
43 |     "a": 3,
   |     ^^^
44 |     a: 3,
45 |     "a": 3,
   |
help: Remove repeated key literal `"a"`

F601 [*] Dictionary key literal `"a"` repeated
  --> F601.py:45:5
   |
43 |     "a": 3,
44 |     a: 3,
45 |     "a": 3,
   |     ^^^
46 |     a: 4,
47 | }
   |
help: Remove repeated key literal `"a"`
   |
44 |     a: 3,
   -     "a": 3,
45 |     a: 4,
   |
note: This is an unsafe fix and may change runtime behavior

F601 [*] Dictionary key literal `"a"` repeated
  --> F601.py:49:14
   |
47 | }
48 |
49 | x = {"a": 1, "a": 1}
   |              ^^^
50 | x = {"a": 1, "b": 2, "a": 1}
   |
help: Remove repeated key literal `"a"`
   |
48 |
   - x = {"a": 1, "a": 1}
49 + x = {"a": 1}
50 | x = {"a": 1, "b": 2, "a": 1}
   |
note: This is an unsafe fix and may change runtime behavior

F601 [*] Dictionary key literal `"a"` repeated
  --> F601.py:50:22
   |
49 | x = {"a": 1, "a": 1}
50 | x = {"a": 1, "b": 2, "a": 1}
   |                      ^^^
51 |
52 | x = {
   |
help: Remove repeated key literal `"a"`
   |
49 | x = {"a": 1, "a": 1}
   - x = {"a": 1, "b": 2, "a": 1}
50 + x = {"a": 1, "b": 2}
51 |
   |
note: This is an unsafe fix and may change runtime behavior

F601 Dictionary key literal `('a', 'b')` repeated
  --> F601.py:54:5
   |
52 | x = {
53 |     ('a', 'b'): 'asdf',
54 |     ('a', 'b'): 'qwer',
   |     ^^^^^^^^^^
55 | }
   |
help: Remove repeated key literal `('a', 'b')`

F601 [*] Dictionary key literal `"x"` repeated
  --> F601.py:58:19
   |
57 | # Regression test for: https://github.com/astral-sh/ruff/issues/4897
58 | t={"x":"test123", "x":("test123")}
   |                   ^^^
59 |
60 | t={"x":("test123"), "x":"test123"}
   |
help: Remove repeated key literal `"x"`
   |
57 | # Regression test for: https://github.com/astral-sh/ruff/issues/4897
   - t={"x":"test123", "x":("test123")}
58 + t={"x":"test123"}
59 |
   |
note: This is an unsafe fix and may change runtime behavior

F601 [*] Dictionary key literal `"x"` repeated
  --> F601.py:60:21
   |
58 | t={"x":"test123", "x":("test123")}
59 |
60 | t={"x":("test123"), "x":"test123"}
   |                     ^^^
61 |
62 | # Regression test for: https://github.com/astral-sh/ruff/issues/12772
   |
help: Remove repeated key literal `"x"`
   |
59 |
   - t={"x":("test123"), "x":"test123"}
60 + t={"x":("test123")}
61 |
   |
note: This is an unsafe fix and may change runtime behavior

F601 Dictionary key literal `1` repeated
  --> F601.py:65:5
   |
63 | x = {
64 |     1: "abc",
65 |     1: "def",
   |     ^
66 |     True: "ghi",
67 |     0: "foo",
   |
help: Remove repeated key literal `1`

F601 Dictionary key literal `True` repeated (`True` hashes to the same value as `1`)
  --> F601.py:66:5
   |
64 |     1: "abc",
65 |     1: "def",
66 |     True: "ghi",
   |     ^^^^
67 |     0: "foo",
68 |     0: "bar",
   |
help: Remove repeated key literal `True`

F601 Dictionary key literal `0` repeated
  --> F601.py:68:5
   |
66 |     True: "ghi",
67 |     0: "foo",
68 |     0: "bar",
   |     ^
69 |     False: "baz",
70 | }
   |
help: Remove repeated key literal `0`

F601 Dictionary key literal `False` repeated (`False` hashes to the same value as `0`)
  --> F601.py:69:5
   |
67 |     0: "foo",
68 |     0: "bar",
69 |     False: "baz",
   |     ^^^^^
70 | }
   |
help: Remove repeated key literal `False`

F601 Dictionary key literal `-0` repeated (`-0` hashes to the same value as `False`)
  --> F601.py:76:16
   |
75 | # Regression test for: https://github.com/astral-sh/ruff/pull/25982#pullrequestreview-4495269928
76 | x = {False: 1, -0: 2}
   |                ^^
77 | x = {-0: 1, False: 2}
78 | x = {True: 1, 1 + 0j: 2}
   |
help: Remove repeated key literal `-0`

F601 Dictionary key literal `False` repeated (`False` hashes to the same value as `-0`)
  --> F601.py:77:13
   |
75 | # Regression test for: https://github.com/astral-sh/ruff/pull/25982#pullrequestreview-4495269928
76 | x = {False: 1, -0: 2}
77 | x = {-0: 1, False: 2}
   |             ^^^^^
78 | x = {True: 1, 1 + 0j: 2}
79 | x = {1 + 0j: 1, True: 2}
   |
help: Remove repeated key literal `False`

F601 Dictionary key literal `1 + 0j` repeated (`1 + 0j` hashes to the same value as `True`)
  --> F601.py:78:15
   |
76 | x = {False: 1, -0: 2}
77 | x = {-0: 1, False: 2}
78 | x = {True: 1, 1 + 0j: 2}
   |               ^^^^^^
79 | x = {1 + 0j: 1, True: 2}
80 | x = {-1: 1, -1 + 0j: 2}
   |
help: Remove repeated key literal `1 + 0j`

F601 Dictionary key literal `True` repeated (`True` hashes to the same value as `1 + 0j`)
  --> F601.py:79:17
   |
77 | x = {-0: 1, False: 2}
78 | x = {True: 1, 1 + 0j: 2}
79 | x = {1 + 0j: 1, True: 2}
   |                 ^^^^
80 | x = {-1: 1, -1 + 0j: 2}
81 | x = {-1 + 0j: 1, -1: 2}
   |
help: Remove repeated key literal `True`

F601 Dictionary key literal `-1 + 0j` repeated (`-1 + 0j` hashes to the same value as `-1`)
  --> F601.py:80:13
   |
78 | x = {True: 1, 1 + 0j: 2}
79 | x = {1 + 0j: 1, True: 2}
80 | x = {-1: 1, -1 + 0j: 2}
   |             ^^^^^^^
81 | x = {-1 + 0j: 1, -1: 2}
82 | x = {-1 + 2j: 1, -1 + 2j: 2}
   |
help: Remove repeated key literal `-1 + 0j`

F601 Dictionary key literal `-1` repeated (`-1` hashes to the same value as `-1 + 0j`)
  --> F601.py:81:18
   |
79 | x = {1 + 0j: 1, True: 2}
80 | x = {-1: 1, -1 + 0j: 2}
81 | x = {-1 + 0j: 1, -1: 2}
   |                  ^^
82 | x = {-1 + 2j: 1, -1 + 2j: 2}
   |
help: Remove repeated key literal `-1`

F601 Dictionary key literal `-1 + 2j` repeated
  --> F601.py:82:18
   |
80 | x = {-1: 1, -1 + 0j: 2}
81 | x = {-1 + 0j: 1, -1: 2}
82 | x = {-1 + 2j: 1, -1 + 2j: 2}
   |                  ^^^^^^^
   |
help: Remove repeated key literal `-1 + 2j`
