Java Child / The Machine Does Exactly What You Said
A Computer Has No Common Sense To Lend You
Everything a person would obviously infer, the machine will not infer at all.
Ask a person to post a letter and they will handle a hundred unstated cases without mentioning any of them. No address, damaged envelope, letterbox full, wrong suburb. They will pause, judge, improvise. A machine will do none of that. It will carry out the step exactly as written and, if the situation does not match what the step assumed, it will either stop dead or, far worse, continue confidently in a nonsensical direction. It has no sense of the ridiculous. Nothing in it says that a negative quantity of items is absurd unless you have said so yourself.
This is uncomfortable at first and then becomes strangely restful. An assistant with no judgement is an assistant with no hidden agenda. It will not quietly reinterpret your request. Whatever happened, happened because of something in the instructions, and instructions can be examined. The absence of common sense means the absence of mystery. When you accept this, the question changes from why is it doing that, which invites frustration, to which of my instructions produces that, which invites investigation.
The obligation this creates is to think about the unusual cases in advance, and specifically about the empty case, the single case, the enormous case and the case where the expected information simply is not there. Most programs are correct for the situation the author imagined and wrong for the four situations they never pictured. Getting into the habit of asking what the strangest reasonable input might be is one of the cheapest quality improvements available to a beginner, and it costs nothing but a few minutes of deliberate pessimism.