Skip to content

ARCE0005: Two commands or queries resolve to the same route

Kind: project. Default severity: error.

Routes are built from the module namespace after segments_to_skip and the kebab-cased name. MyApp.Authors.Register and Other.Authors.Register both serve /api/authors/register when one segment is skipped. The rule reports every command that shares a route with another command, and every query that shares one with another query. A command and a query with the same route are not reported: they differ by HTTP method.

Arc cannot send one request to two modules, so one of them is unreachable, and the generated proxies of the two would overwrite each other. It only shows when the second module is added, in a different part of the codebase, which is why it is a project rule.

defmodule MyApp.Authors.Register do
use Arc.Command
# ...
end
defmodule Backoffice.Authors.Register do
use Arc.Command
# ...
end

Both serve /api/authors/register.

Give one of them a name or a namespace of its own:

defmodule Backoffice.Authors.RegisterByStaff do
use Arc.Command
end

Rename one module or move it to a different namespace after the skipped segments. Set segments_to_skip under config :cratis_arc, :analyzer to the same value as your Arc.Application, so the rule sees the routes you serve.