Dialyzer shows the warning "The pattern can never match the type" on create a basic Phoenix api

I created a project using the command:

mix phx.new elixir_api \
  --no-assets \
  --no-dashboard \
  --no-ecto \
  --no-gettext \
  --no-html \
  --no-mailer \
  --binary-id

Then I opened the project in VSCode and browsed to the file ./lib/elixir_api_web/router.ex and the IDE shows me a warning like this:

The pattern can never match the type.

Pattern:
{_, _, _, _}

Type:
:error
ElixirLS Dialyzer

The file has only the automatically generated code. Why is this warning appearing then, since when running the application it doesn’t bring me any warning messages?

1 Like

That message appears to be related to --no-html, based on the last comment here:

3 Likes

TL;DR: You can’t have an empty scope statement (no routes) in router.ex

1 Like