Some people using a small diagnostic page were handed the nine-letter word undefined where their visitor address should have been. The page came back normally, with no crash and no blank screen. The wrong answer sat there looking respectable while it cost us time to find.

The job: take the first real answer of three

During a change in how visitor addresses reached the site, the page needed to choose the first real answer from three possible places. If the first place had nothing, it should try the second. If that had nothing, it should use the last one.

That is like picking the first ripe apple from three bowls. An empty first bowl should send you to the next bowl.

The fix that came too late

We first put the three choices into one short line and turned the final result into text. We expected that one step to make the answer safe to display. It did not. The conversion happened too late, because the page had already picked the wrong thing before it was turned into words.

The page runs on JScript, an older kind of JavaScript. In that environment, asking for a missing value does not give you an empty answer. It gives you an empty container.

Picture an empty jar on a kitchen counter. The jar has nothing in it, but it is still a jar. If someone asks whether there is something on the counter, the answer is yes. The program made the same mistake. It saw the first container, treated it as something worth choosing, and never looked at the second or third place where a real answer might be waiting.

When the page finally turned that empty container into text, it did not print a blank. It printed the literal word undefined.

That is why the bug was so slippery. A basic check could see that the page loaded. The response was successful. There was ordinary-looking text in the body. Nothing announced itself as broken. But for the visitors who needed the fallback path, the page was confidently telling them something untrue.

The shared routine that worked

A good piece of shared code had misled us. Elsewhere, one small routine was built to solve this exact problem. Before it chose among the three possible values, it cleaned each one separately. An absent value became a blank answer. A blank answer does not get picked, so the routine moved on to the next possibility.

That shared routine had been working. The three pages that failed did not use it. Each had a copied version of the same idea, with one tiny difference: they chose first and cleaned later.

What it cost

This was not a dramatic outage. No alarm goes off for a page that technically keeps working. The cost was investigation time, because the screen looked healthy. It cost patience, because a normal response had to be treated as suspicious. And three separate pages, including administrative work, could show the wrong thing before the pattern was clear.

The repair, and asking the page itself

Hiding the word undefined would only have covered the problem. The repair was to make each possible answer empty or usable before the page chose among them. Then a controlled request through every affected path returned a real value instead of the wrong word.

That check mattered. Reading a changed line of code and nodding at it is not the same as asking the page the question it must answer in real life.

The larger job came after the visible fix. We searched for other copies of the same shortcut. A shared, safer recipe and several hand-copied recipes had drifted apart. The old shared routine was protecting itself. The copies were not.

This has nothing to do with visitor addresses. A spreadsheet, a form, a customer email template, or a website page can all have the same problem. When a trusted version works and look-alikes exist elsewhere, each look-alike has to be checked for the same protection, and tested the way a visitor would use it.

The empty container was doing exactly what an empty jar does. It existed, it took up a slot, and it answered “is something here” with yes. JScript never lied to us. The page asked whether something was there, when it needed to ask whether the answer was usable before a visitor’s address got printed to a screen.