A route order conflict happens when a router that takes the first match meets a path parameter registered above a literal path of the same shape. Ours had /profiles/:id/stop above /profiles/bulk/stop, so the parameter caught the word bulk as a profile id. The literal route was registered, documented and unreachable, and the request that should have reached it got a 200.
What the two calls returned
Mosaic's local REST API can start and stop a selection of profiles in one call. Both bulk routes sat in the file below the single-profile routes they resemble. These are the two answers we measured before the routes were moved:
POST /profiles/bulk/start 404 {"error":"Profile bulk not found"}
POST /profiles/bulk/stop 200 {"stopped":true}
The first is a nuisance. A caller gets an error, reads it, and wonders why the API is looking for a profile called bulk. The second is the one that matters. A caller who typed the documented path correctly got a success for an operation that never ran. Send it forty profile ids and all forty browsers stay open, while the script that asked for them to close moves on.
How a route order conflict with a path parameter happens
Our router is small on purpose. It splits the path into segments and walks the routes in the order they were added. For each route with the same method and segment count, a segment starting with : matches anything and a literal segment must be equal. The first route where every segment passes wins.
/api/v1/profiles/:id/stop and /api/v1/profiles/bulk/stop are both five segments. The first was added earlier. Its :id accepts bulk, its stop equals stop, so it matched and the loop returned. The bulk handler was never consulted.
This is not peculiar to hand-written routers. FastAPI's tutorial has a section called "Order matters" for the same case: path operations "are evaluated in order", so /users/me has to be declared before /users/{user_id}. Some routers rank a literal segment above a parameter whatever the order. Ours did not, and nothing told us.
Everything the window does, from a script on your own computerIn Mosaic: REST API. Everything the window does, from your own scripts. Free covers 3 profiles with no card, and Pro is $25 a month for any number of them.
Mosaic is a desktop app
Email yourself the link and open it on your computer.
Why the wrong route said yes
Shadowing explains why the bulk handler did not run. It does not explain the 200. That came from a second fault in the single-profile handler: it never checked that the profile existed. Stopping an id the launcher had never seen resolved quietly, so the route answered {"stopped":true} for any string at all. We measured it on a uuid that had never existed and on the literal bulk, with the same answer for both.
The start route had the opposite habit. It looked the profile up, failed, and said so, which is why bulk/start came back as a readable 404. Same shadowing, same router, and only one of the two routes could tell a typo from a real id.
The fix for the second fault is one line. The stop handler looks the profile up first, and an unknown id is a 404. Stopping a profile that exists and is not running is still a success, because the caller asked for an end state and has it. Stopping a profile that does not exist is a mistake in the request.
The fix, and why it is a build check
Moving the two bulk routes above /profiles/:id/start fixed them. The other bulk/* routes had been safe only by luck: nothing declares /profiles/:id/edit or /profiles/:id/delete, so nothing could shadow them. Somebody adding /profiles/:id/<word> next year would break them again in the same silent way.
So npm run check:api, which already failed the build when a route was missing from the API reference, also reads the routes in registration order. For every pair with the same method and segment count, it asks whether the earlier one matches the later one with at least one parameter doing the work:
for k in segments:
earlier[k] is :param and later[k] is :param -> different route, no conflict
earlier[k] is :param -> eats later[k]
earlier[k] != later[k] -> no conflict
conflict if every segment passed and a param was used
A hit fails the build with both routes named and one instruction: register the literal path above the one with the parameter. The check could not have been written on the old data. Its first version kept the routes in a set, which proved that bulk/stop existed and was documented the whole time it was broken. A set has no order, and order was the whole question.
The same check now guards three more literals our comments call out by name. GET /providers/vendors would otherwise answer Provider vendors not found, GET /proxies/checking would answer Proxy checking not found, and /proxies/export would be read as a proxy id.
What a caller should do about it
If an API answers a bulk or literal route with something that looks like a single-item reply, suspect shadowing first. Two signs give it away. The error names your literal as an id, as Profile bulk not found did. Or the response has the single-item shape ({"stopped":true}) where the bulk route documents counts and failures by id: ours answers ok, skipped and a failures list naming each profile.
Mosaic's local API guide lists every route as it is registered, and the reference and the router are held to each other by the same check. Our tally that counted rows nobody could read is the same lesson from the detector side: a claim that something exists is not a measurement that it ran.
Sources
- FastAPI tutorial: Path Parameters, Order matters, read November 3, 2026






