diff --git a/Library/Homebrew/cli/named_args.rb b/Library/Homebrew/cli/named_args.rb index e26a8d15f0..c6f6f60976 100644 --- a/Library/Homebrew/cli/named_args.rb +++ b/Library/Homebrew/cli/named_args.rb @@ -140,7 +140,8 @@ module Homebrew warn_if_cask_conflicts(name, "formula") if only != :formula return formula rescue FormulaUnreadableError, FormulaClassUnavailableError, - TapFormulaUnreadableError, TapFormulaClassUnavailableError => e + TapFormulaUnreadableError, TapFormulaClassUnavailableError, + FormulaSpecificationError => e # Need to rescue before `FormulaUnavailableError` (superclass of this) # The formula was found, but there's a problem with its implementation unreadable_error ||= e diff --git a/Library/Homebrew/cli/parser.rb b/Library/Homebrew/cli/parser.rb index c667283ac0..993df1a3e8 100644 --- a/Library/Homebrew/cli/parser.rb +++ b/Library/Homebrew/cli/parser.rb @@ -653,7 +653,7 @@ module Homebrew begin Formulary.factory(arg, spec, flags: argv.select { |a| a.start_with?("--") }) - rescue FormulaUnavailableError + rescue FormulaUnavailableError, FormulaSpecificationError nil end end.compact.uniq(&:name)