When your reach is global, it's perhaps difficult not to inadvertently stick your fingers in a few places they don't belong — especially if you happen to be rocking the blithe self-assurance of one Mark Zuckerberg.

When a natural disaster strikes, people often turn to Facebook to express sympathy and concern for those caught in Mother Nature's unforgiving wake. And, at least in the case of the Sunday earthquake in Indonesia that has so far claimed the lives of over 300 people, Facebook responded by treating that concern as a cause for celebration.

That's right, when people posted to Facebook in Indonesian that they hoped victims of the quake would survive the ordeal, Facebook showered their posts with balloons and confetti. Balloons. And confetti.

So how does something this bonkers happen? Well, it turns out that the oft-touted Menlo Park artificial intelligence still has some learning to do.

"'Congrats' in Indonesian is 'selamat'," wrote Herman Saksono on Twitter after noticing this, shall we say, discrepancy. "Selamat also means 'to survive.' After the 6.9 magnitude earthquake in Lombok, Facebook users wrote 'I hope people will survive'. Then Facebook highlighted the word 'selamat' and throw some balloons and confetti."

“Congrats” in Indonesian is “selamat”. Selamat also means “to survive.”

After the 6.9 magnitude earthquake in Lombok, Facebook users wrote “I hope people will survive”. Then Facebook highlighted the word “selamat” and throw some balloons and confetti. pic.twitter.com/DEhYLqHWUz

Yeah, that's pretty messed up. Facebook, of course, was quick to point out that the system was just doing what it was programed to do. However, in the process, it failed to understand the nuances of language.

“This feature (a text animation triggered by typing ‘congrats’) is widely available on Facebook globally, however we regret that it appeared in this unfortunate context and have since turned off the feature locally,” Facebook spokesperson Lisa Stratton told Motherboard over email. “Our hearts go out to the people affected by the earthquake.”

Facebook CEO Mark Zuckerberg has long pointed to machine learning as an important technology that could one day save us from the scourge of nefarious political influence campaigns and so-called fake news. However, as this recent mishap shows, even some of his company's most basic features still have a long way to go.

So congratulations, Facebook users! Er, sorry, I mean I hope we all survive the future Facebook is building for us — one line of ill-advised code at a time.