When does ein/eine/einen mean "one" vs. "a/an"?
I translated "Er hat einen Hund" into the English "He has a dog." Duolingo said that was incorrect. The correct answer was "He has one dog." When does ein/eine/einen mean "one" vs. "a/an"?
I assume that there was some mistake or typo in your answer you didn’t notice. The corrected sentences that DL suggests on the main page sometimes are somewhat bizarre. DL often insists on “one” instead of the article when the article was left out, direct instead of indirect, or there was some other related error with the noun itself. It’s always a good idea to check the discussion section to see the actual preferred translation when the suggested correct answer seems weird:
Was this your sentence? As you can see, the preferred translation is indeed “a dog”.
And just to add to what Jileha said, and answer your question directly, it is next to impossible to work out when "ein" translates to "one" vs. "a(n)". The only context I can imagine it being clear is when numbers have been mentioned specifically, z.B.:
„Er hat einen Hund, zwei Katze und drei Pferde. Er spinnt doch, oder?“
"He has one dog, two cats and three horses."
It really isn't something I would spend time worrying about, because even in the example I gave you could say "a dog" and it would sound perfectly fine.