diff --git a/Library/Homebrew/dev-cmd/test-bot.rb b/Library/Homebrew/dev-cmd/test-bot.rb
index bf332ac256d01597a156105f67a6af222a4f82de..dc176f52e00578b15d4d3f3bb31b153acc7586ab 100644
--- a/Library/Homebrew/dev-cmd/test-bot.rb
+++ b/Library/Homebrew/dev-cmd/test-bot.rb
@@ -248,8 +248,9 @@ module Homebrew
     def safe_formula_canonical_name(formula_name)
       Formulary.factory(formula_name).full_name
     rescue TapFormulaUnavailableError, FormulaUnavailableError => e
-      raise if e.tap.installed?
-      test "brew", "tap", e.tap.name
+      exception_tap = e.tap || CoreTap.instance
+      raise if exception_tap.installed?
+      test "brew", "tap", exception_tap.name
       retry unless steps.last.failed?
       onoe e
       puts e.backtrace