diff --git a/compiler/GHC/Types/Error.hs b/compiler/GHC/Types/Error.hs
index ef94dd2125208bf3073bc48032b524edf68179f0..a0306db5592a472101d3d42dc7b6112f31191ac1 100644
--- a/compiler/GHC/Types/Error.hs
+++ b/compiler/GHC/Types/Error.hs
@@ -659,7 +659,7 @@ mkLocMessageWarningGroups show_warn_groups msg_class locn msg
 
           code_doc =
             case msg_class of
-              MCDiagnostic _ _ (Just code) -> brackets (coloured msg_colour $ ppr_with_hyperlink code)
+              MCDiagnostic _ _ (Just code) -> brackets (ppr_with_hyperlink code)
               _                            -> empty
 
           flag_msg :: Severity -> DiagnosticReason -> Maybe SDoc
diff --git a/testsuite/tests/ghc-e/should_fail/T24172.hs b/testsuite/tests/ghc-e/should_fail/T24172.hs
new file mode 100644
index 0000000000000000000000000000000000000000..30a889a09b5a22830219199f725d9770dd45f57f
--- /dev/null
+++ b/testsuite/tests/ghc-e/should_fail/T24172.hs
@@ -0,0 +1 @@
+main = print $ 1 + Bool
diff --git a/testsuite/tests/ghc-e/should_fail/T24172.stderr b/testsuite/tests/ghc-e/should_fail/T24172.stderr
new file mode 100644
index 0000000000000000000000000000000000000000..83ec6c2a5bca93e0d3d52000a78ad3034b534557
--- /dev/null
+++ b/testsuite/tests/ghc-e/should_fail/T24172.stderr
@@ -0,0 +1,8 @@
+
+T24172.hs:1:20: error: [GHC-01928]
+    • Illegal term-level use of the type constructor ‘Bool’
+    • imported from ‘Prelude’ at T24172.hs:1:1
+      (and originally defined in ‘GHC.Types’)
+    • In the second argument of ‘(+)’, namely ‘Bool’
+      In the second argument of ‘($)’, namely ‘1 + Bool’
+      In the expression: print $ 1 + Bool
diff --git a/testsuite/tests/ghc-e/should_fail/all.T b/testsuite/tests/ghc-e/should_fail/all.T
index f4840f9685783902656ea9e056899aecddbb3b4d..0a1f262d681c4e6662fa03dc6f6c8d1666233273 100644
--- a/testsuite/tests/ghc-e/should_fail/all.T
+++ b/testsuite/tests/ghc-e/should_fail/all.T
@@ -56,3 +56,5 @@ test('T18441fail18', req_interp, makefile_test, ['T18441fail18'])
 test('T18441fail19', [ignore_stderr, exit_code(1)], run_command, ['{compiler} -e ":cd abcd"'])
 
 test('T23663', req_interp, makefile_test, ['T23663'])
+
+test('T24172', normal, compile_fail, ['-fdiagnostics-color=always'])
diff --git a/testsuite/tests/warnings/should_fail/Colour.stderr b/testsuite/tests/warnings/should_fail/Colour.stderr
index 79b3ef96833d201161b464b7306f512c9dde527a..a389680cd69ff651aee118f84552d9584caf7875 100644
--- a/testsuite/tests/warnings/should_fail/Colour.stderr
+++ b/testsuite/tests/warnings/should_fail/Colour.stderr
@@ -1,5 +1,5 @@
 
-Colour.hs:1:8: error: [GHC-83865]
+Colour.hs:1:8: error: [GHC-83865]
     • Couldn't match expected type ‘IO ()’ with actual type ‘()’
     • In the expression: () :: IO ()
       In an equation for ‘main’: main = () :: IO ()