Smart Lookup Found the Address, Then Threw It Away
Vendor Smart Lookup is one of the smaller promises Bakery Buddy makes: type a business name, like a venue or a florist, and it fills in the address, contact info, and category by itself, pulled from a free business-lookup API, instead of you typing it all in by hand. For a whole class of real results, picking one did the opposite of autofill. It could blank out the address and website the lookup had just found, and switch the category to one you never chose.
A tag that doesn't match anything
The lookup provider describes a place with a list of loose tags, things like "banquet_hall" or "florist" or "wholesale." Bakery Buddy turns that list into one of five vendor categories: venue, florist, supply, rental, or other. Most tags map cleanly. A lot of real places don't carry one of the specific tags at all. OpenStreetMap, the free provider the app defaults to, tags a large number of genuine event venues as nothing more specific than `building=commercial`, which doesn't match any of the category hints the app was looking for.
When nothing matched, the function fell back to a default category, 'other.' That default and a real, confident match were both just a string. Nothing about the value itself said whether the code had actually recognized the place or had simply shrugged and picked something.
The form trusted the guess the same as a real answer
A second piece of code read that category and decided which fields to actually fill in on the form. A venue got its address, contact name, phone, and email. A florist got contact name, phone, email, and website. 'Other' got role, contact name, phone, and email, deliberately leaving off address and website, because a generic vendor shouldn't have fields forced on it that don't apply. That filtering made sense, as long as the category it was filtering by was actually correct.
It wasn't, for every real venue that happened to carry a tag the app didn't recognize. The moment one of those fell through to 'other,' the field filter treated 'other' as the genuine, chosen category, and the address and website the lookup had already found, correctly, for that exact place, both got dropped before they ever reached the screen. The category chip switched to 'other' too, overriding whatever you'd already picked by hand, for the same reason. Picking a real, correctly-found result could leave the form looking mostly empty, under a category nobody chose.
Splitting one function into two questions
The fix wasn't a smarter guess. It was refusing to let a guess and a real answer share one value. The category-mapping function now answers two separate questions instead of one:
- Does this place's data match a category with real confidence? Answered once, honestly. When nothing matches, it now returns an actual "I don't know" instead of quietly standing in a default.
- Should picking this result change the category showing on screen? Only when the first answer was a confident one. A fallback guess leaves whatever you'd already chosen alone.
Filling in the data fields stopped depending on either answer. Every field the lookup actually returned, address, phone, email, website, whatever it has, now gets copied onto the form regardless of which category it lands under. The category controls what the form displays. It no longer controls what data survives the trip from the API to the screen.
Checked against the live provider with a real local venue tagged exactly the way that used to fail, `building=commercial`, picking it now fills in the name, address, and website, and leaves the category exactly where it was left.
What a shrug and an answer have in common, right up until they don't
"We know what this is" and "we're guessing, and defaulted to something" look identical once they're both sitting in a variable of the same type. A category that's just a string doesn't carry its own confidence along with it. Any time code has to default to something because it genuinely doesn't know, that default and a real answer need to stay tellable apart all the way downstream, not just inside the one function that produced them.
And whatever that distinction is protecting is worth naming plainly. Here it was two things: a choice you'd already made by hand, and data a working API call had already correctly returned. Neither should disappear because some other part of the code, somewhere else, wasn't sure.
If a feature in your own product infers something and then acts on that inference, check whether "I don't know" and "I decided" can still be told apart by the time that value reaches the part of the code that actually matters. You can see Vendor Smart Lookup and the rest of what Bakery Buddy does for the back office today.
Frequently Asked Questions
What was the actual bug?
Vendor Smart Lookup maps a business-lookup provider's place tags onto one of five vendor categories. When a real place's tags didn't match any of the specific category hints, the code defaulted to the category 'other' rather than flagging that it wasn't sure. A second piece of code only copied fields considered relevant to the resolved category onto the form, and 'other' doesn't include address or website. So a genuine venue that happened to carry an unrecognized tag lost its address and website the moment you picked it, and the category chip switched to 'other' even if you'd already picked a different one by hand.
Why didn't this only affect obscure or bad results?
It affected any correctly-found place whose provider tags simply didn't happen to match the app's category hints, which includes plenty of real, well-known venues. OpenStreetMap, the free default provider, tags a large number of genuine event venues as nothing more specific than building=commercial, a label that doesn't match any category-specific pattern. The lookup had found the right place with the right data; the bug was entirely in what happened after that.
How was it fixed?
The category-mapping function now distinguishes a confident match from a fallback guess, instead of returning the same kind of value for both. The category chip only auto-switches on a confident match. Filling in the data fields stopped depending on the category at all: every field the provider actually returned now gets copied onto the form regardless of which category it resolves to. Verified against the live provider with a real venue tagged building=commercial, which previously triggered the bug.
What's the general lesson?
A default value and a genuine answer can look identical once they're stored in the same type, like a plain string. Any time code has to guess because it doesn't actually know, that guess needs to stay distinguishable from a real answer all the way through the rest of the system, not just inside the function that produced it. Otherwise something downstream will eventually treat a shrug as a fact, and here that meant throwing away data a working API call had already correctly returned.
I build Bakery Buddy for my wife Lindsay's cake studio, Marin Cake Studio, and this is the bug that taught me a default and an answer are not the same thing just because they look alike.
Ready to put this into practice?
Join the Waitlist