Founder Notes
A Fallback Is an Answer
I typed a company's name into a box that wanted an identifier, and the page told me a current record was on file. It wasn't. Nothing had been looked up. The request that would have answered the question was never answered, and the screen reported the most reassuring of the available outcomes.
Two things had to be true for that to happen, and neither was a mistake on its own. That is the part worth writing down.
The parser was forgiving
People don't always paste a bare identifier. Sometimes they paste the whole link that contains one. So the input handler looked for an identifier anywhere inside what you typed and pulled it out when it found one.
When it didn't find one, it returned what you typed.
That line reads like generosity. It comes from the same instinct as trimming whitespace or accepting either case — be liberal in what you accept. But there is no best-effort version of an identifier. Either the input contains one or it does not, and when it does not, handing back the raw string doesn't preserve the user's intent. It destroys the only fact that mattered, which is that the parse failed. Past that line, nothing downstream can tell an identifier from a sentence. Both are strings, and one of them is lying about where it came from.
A parse has two honest outcomes: a value, or nothing. A fallback is a third thing, and the third thing is an answer you made up.
The error handling enumerated the failures I had thought about
The request went out with a name where an identifier belonged. The service did exactly the right thing and rejected it, with a status that means the input was invalid.
The client handled one failure explicitly: the meaningful one, where the identifier is well formed and there simply is no record. That case has real content. It is a genuine no, and it gets its own panel that says so.
Everything else fell through to the success path, which read the response body and rendered it as a record.
In TypeScript the last step is a type assertion. You fetch, you parse the JSON, and you tell the compiler the result is the shape you expect. The compiler believes you, because that is what an assertion is — a promise, not a check. The bytes were a validation error. The object had none of the fields the panel wanted. The panel rendered anyway: affirmative heading, everything under it empty.
Two defensible decisions. Be liberal in what you accept. Handle the failure that carries meaning. Composed, they manufacture the one output the page exists to prevent.
The third answer
The page has a job, which is to answer "can I trust this?" about somebody else. There are three honest responses to that question — yes, no, and I don't know — and the bug deleted the third one. Not by getting it wrong, but by not having it. Every path through the code ended in either a record or a specific no. There was no state that meant nothing was asked.
The ways of being wrong here are also not equally bad. Telling someone no when the answer is yes is an annoyance, and they come back with a better identifier. Telling someone yes when the truth is that no question was ever asked is a false statement about a third party, published in their name, by a page whose entire value is that people believe it.
I found it while getting the page ready to show to someone. That is the ordinary way this class of bug surfaces: not from a test, because every unit involved did what it said it did, but from a person typing the wrong thing in and being struck by how confident the answer was.
The fix is smaller than the lesson
The parser now returns nothing when it finds no identifier, and nothing is a rejection rather than a fallback, so no request goes out at all. Any response that is not a success and is not the one meaningful not-found renders as a rejected request, with the status visible. Both new states say the same two things in different words: nothing was looked up, and this is not a statement about the subject.
That second sentence is what I would want in any system that reports on other people. The absence of a result has to be sayable — out loud, in the interface, in the type — or it gets rendered as whichever real result happens to sit closest to it structurally.
The general form
A fallback is an answer. When code cannot tell what it is looking at, the only honest return is nothing, because a default converts "I don't know" into "I know," and every layer downstream inherits the confidence without inheriting the doubt.
And error handling that enumerates the failures you thought of will route every failure you didn't think of into the success branch. Not because that branch is wrong, but because it is the default, and the default is where unclassified things go.
Most systems don't make a false statement by computing the wrong answer. They make one by having no way to say they never computed an answer at all.