# When an API returns 200 but does nothing

> Our first API answered 200 to a misspelt field, a port of 70000 and a delete of nothing. Eight requests we measured, and the three rules that fixed them.

Source: https://mosaicbrowser.com/blog/a-200-that-did-nothing

## A 200 that did nothing is the worst answer an API can give

Our first API answered 200 to a misspelt field, a port of 70000 and a delete of nothing. Eight requests we measured, and the three rules that fixed them.

![200: 200, and nothing happened, beside a screenshot: mosaic API keys: one per script or tool, each revocable on its own](https://mosaicbrowser.com/covers/a-200-that-did-nothing.webp)

When an API returns 200 but does nothing, it has usually dropped part of your request without telling you: a misspelt field, a value it could not use, an id that matched nothing. RFC 9110 says a 200 [indicates that the request has succeeded](https://www.rfc-editor.org/rfc/rfc9110.html). Our own first API gave that answer to eight requests that had not succeeded at all, and we only found out by sending them on purpose.

## Eight requests where our API returned 200 but did nothing

Mosaic has a local REST API at `/api/v1`, and our build already checked that every route existed. Nothing checked what a route did with a bad request. So we sent bad requests to the running app, before fixing anything, and wrote down what came back:

```
PATCH /settings {"apiPort": "not-a-number"}  200, and it stored the string
PATCH /settings {"theme": "chartreuse"}      200
POST  /projects {}                           500 "…undefined (reading 'trim')"
POST  /proxies/parse {"text": 12}            500 "text.split is not a function"
POST  /proxies {"host":"h","port":70000}     200, stored, failed at launch
POST  /profiles {"count": "abc"}             200 carrying undefined
POST  /profiles/bulk/delete {}               200 {"deleted": 0}
DELETE /profiles/does-not-exist              200 {"deleted": true}

```

Every row tells the caller something worked when it did not. The `apiPort` row could have bricked the app: the next start would have tried to listen on a string. The port of 70000 was saved, shown as a working proxy and failed only when somebody launched a profile behind it, far from the request that caused it.

The last two are the worst. A delete that deleted nothing and a delete of a misspelt id both came back as success, byte-identical to a real one. From outside, there was no way to see the bug.

Mosaic is a desktop app

Email yourself the link and open it on your computer.

[How it works: REST API](https://mosaicbrowser.com/features/rest-api)

## Why "be liberal in what you accept" fails here

The usual argument for ignoring an unknown field is forward compatibility: an old server should not choke on a newer client's extra key. That argument assumes the extra key is harmless. In a settings call it is the opposite.

Take `PATCH /settings` with `maxConcurentProfiles`, one `r` short. A server that drops it answers 200. The caller now believes a cap on running browsers is in force, and it is not. Nothing will ever tell them, because the next read of settings shows the old value and nobody reads settings back after writing them.

## The three rules

All three live in one file, `validate.ts`, which every REST route goes through.

1. **An absent field is not an invalid one.** Our bodies are PATCH-shaped, so leaving a key out leaves that value alone. Only a key that is present and wrong is an error. That is what lets a caller send one field without restating the rest.
2. **Never silently repair.** Clamping `-1` to `1` leaves the caller believing something untrue about what was stored. Refuse, and name the field and the reason.
3. **An unknown key is an error, not something to drop.** `PATCH /settings` with `maxConcurentProfiles` now returns a 400 that lists the real setting names.

The second rule is the one people argue with, because a repair feels helpful. It is helpful to the person who sent `-1` by accident and saw nothing. It is harmful to the script that sent `-1` meaning something, and to everyone who later reads the stored value and trusts it.

## A 500 is our bug

Two rows in the table were 500s with messages like `Cannot read properties of undefined (reading 'trim')`. That sentence describes a line in our code. It means nothing to the caller, and it told them their request had broken the server when their request was simply missing a name.

So the handler now does two different things. A 4xx message is written for the caller and passed through untouched: it says which field and what to send. A 500 is logged in full on our side, and the caller gets one sentence saying it was an internal error. If a message tells the caller what to do, it is a 400, never a 500.

## The same lie in a batch

The single request is the easy case. A batch can tell the same lie at scale. Warm-up runs one plan across many profiles, and "warmed 40 profiles" over eight failures is a 200 that did nothing, eight times, in a run nobody watched. Every profile in a batch now gets a row with its name and whether it worked, and one dead proxy costs its own row rather than the batch.

Closing a browser had the same fault in a quieter form. Two of the code paths that trash a profile stopped its browser with `.catch(() => undefined)`, which turns "it would not close" into a clean success. The profile vanished from the list while its window stayed open on its proxy. A stop that fails now costs the trash: the profile stays on the list, where it still has a Stop button.

## How we keep it fixed

A script sends the whole matrix, forty-odd malformed requests and the shape of every collection, to a running app, and fails if any comes back as a success. It is not part of the normal build, because a check that needs a running app should not be able to fail a build for the wrong reason, so we run it by hand after API changes.

The same rules hold on MCP, the API's other door, where a model is the caller and cannot ask what an error meant; [letting an AI assistant run browser profiles](https://mosaicbrowser.com/blog/ai-assistant-runs-profiles) has the three faults a model found. The routes themselves are listed on the [REST API page](https://mosaicbrowser.com/features/rest-api), and what a local API in this kind of browser should and should not do is in [the anti-detect browser local API guide](https://mosaicbrowser.com/guides/anti-detect-browser-local-api).

## Sources

1. [RFC 9110: HTTP Semantics, 200 OK and 400 Bad Request](https://www.rfc-editor.org/rfc/rfc9110.html), read November 2, 2026

## Questions

### Why does an API return 200 but nothing changes?

Usually because the server dropped part of the request without saying so: an unknown or misspelt field, a value it could not use, or an id that matched nothing. The status code reports that the request was handled, not that it did what you meant.

### Should an API ignore unknown fields?

We refuse them with a 400 that names the field. A misspelt field that is silently dropped and a field that was stored look identical from outside, so the caller cannot find the mistake.

### What should a delete of something that does not exist return?

Not a 200 that says it was deleted. Mosaic's API answers an unknown id with an error naming what was not found, and a destructive route with no scope at all is a 400.

### Is a 500 ever the right answer to a bad request?

No. A 500 means the server has a bug. A request the caller can fix should get a 4xx with a sentence telling them what to fix.

## Related

[Anti-detect browser REST API: profiles from your scripts](https://mosaicbrowser.com/features/rest-api): Mosaic's anti-detect browser REST API runs on 127.0.0.1 with API keys. Create and start profiles, then attach Puppeteer or Playwright over CDP.

[Anti-detect browser local API: what it is and what to check](https://mosaicbrowser.com/guides/anti-detect-browser-local-api): An anti-detect browser local API is an HTTP server on 127.0.0.1 that creates, starts and stops profiles and hands your script a DevTools endpoint.

[An anti-detect browser MCP server for your AI assistant](https://mosaicbrowser.com/features/mcp-server): Mosaic's anti-detect browser MCP server lets Claude or any MCP client create, launch and drive your profiles. 150+ tools, off by default, key-gated.

[Letting an AI assistant run browser profiles over MCP](https://mosaicbrowser.com/blog/ai-assistant-runs-profiles): Mosaic's MCP server lets Claude or any MCP client create, start and drive browser profiles. Three faults we found when a model was the caller.

[How to automate multiple browser profiles](https://mosaicbrowser.com/guides/automate-multiple-browser-profiles): Automate multiple browser profiles by giving each account a persistent profile, starting each from a script and attaching Playwright or Puppeteer over CDP.







[POST /profiles/bulk/stop answered 200 and stopped nothing](https://mosaicbrowser.com/blog/route-pattern-swallowed-a-path): A route order conflict with a path parameter let /profiles/:id/stop read 'bulk' as an id and answer 200. Our build now fails on any shadowed route.

## Mosaic, on your own computer

The browser this blog is about: its own Chromium, fingerprints from real machines and a proxy IP per profile. 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.
