Paralus wrote: when he arrived at the Persian Gates,’ he found that Ariobarzanes, the viceroy of Persis, with 40,000 infantry and 700 cavalry, had built a wall across the pass, and had pitched his camp there near the wall to block Alexander’s passage. Then indeed he pitched his camp there; but next day he marshaled his army, and led it up to the wall. When it was evident that it would be difficult to capture it on account of the rugged nature of the ground, and as many of his men were being wounded, the enemy assailing them with missiles from engines of war placed upon higher ground, which gave them an advantage over their assailants, he retreated to his camp.
This is all Arrian (3.18.2-4) cares to report on the matter. Perhaps the "official" line from his source was this short. Still, the key word is "retreated". The so called "vulgate" sources are less coy:
Diodorus 17.68.1-3:
Thereafter Alexander marched on in the direction of Persis and on the fifth day came to the so-called Susian Rocks. Here the passage was held by Ariobarzanes with a force of twenty-five thousand infantry and three hundred cavalry. The king first thought to force his way through and advanced to the pass through narrow defiles in rough country, but without opposition. The Persians allowed him to proceed along the pass for some distance, but when he was about half-way through the hard part, they suddenly attacked him and rolled down from above huge boulders, which falling suddenly upon the massed ranks of the Macedonians killed many of them. Many of the enemy threw javelins down from the cliffs into the crowd, and did not miss their mark. Still others coming to close quarters flung stones at the Macedonians who pressed on. The Persians had a tremendous advantage because of the difficulty of the country, killed many and injured not a few. Alexander was quite helpless to avert the sufferings of his men and seeing that no one of the enemy was killed or even wounded, while of his own force many were slain and practically all the attacking force were disabled, he recalled the soldiers from the battle with a trumpet signal. Withdrawing from the pass for a distance of three hundred furlongs, he pitched camp and from the natives sought to learn whether there was any other route through the hills.
Curtius 5.3.17-23
This pass Ariobarzanes had occupied with 25,000 infantry. It comprises steep cliffs, precipitous on all sides, on top of which stood the Persians, out of weapon-range, deliberately inactive and giving the impression of being fear-stricken. as they waited for the Macedonian force to enter the narrowest part of the defile. When they saw the Macedonians advancing with no regard for their presence, they began to roll massive rocks down the mountain slopes, and these would frequently rebound from rocks lower down and fall with even greater velocity, crushing not only individuals but entire companies. Stones, shot from slings, and arrows were also showered on them from every direction. But the greatest source of anguish for Alexander's courageous men was not this but their inability to strike back, their being caught and slaughtered like animals in a pit. Anger turned to rage. They grasped at the jutting rocks and, one giving another a lift, kept trying to clamber up to their enemy, but with the hands of many simultaneously pulling at them the rocks would break loose and fall back on the men who had dislodged them. Thus they could neither make a stand nor press ahead, nor even gain protection from a tortoise-formation of shields, because of the vast size of the objects hurled down by the barbarians. Alexander suffered agonies, as much of shame as despondency, at his foolhardiness in stranding his army in the gorge. Till that day he had been unbeaten: none of his undertakings had failed. No harm had come to him entering the ravines of Cilicia, or when the sea had provided him with a new route into Pamphylia. But now his good fortune was arrested, stopped dead, and the only remedy was to go back the way he had come. And so, signalling the retreat, he ordered the men to leave the pass in close formation with shields interlocked above their heads; and they drew back a distance of thirty stades.
No matter that the Macedonian eventually went around the pass and trapped the Persian (redolent of Thermopylae), this thoroughly ill-considered assault was clearly a defeat and a rather costly one ending in retreat (in all sources). It likely goes a long way to explaining Plutarch's note (Alex.37.3) after his allusion to this action (which he does not describe):
In this country (Persis), then, as it turned out, there was a great slaughter of the prisoners taken; for Alexander himself writes that he gave orders to have the inhabitants butchered, thinking that this would be to his advantage...
Ah, Perseopylae indeed!
If I understand this "loss" correctly, it is something along the lines of Alexander arrived at the Persian Gates, was defeated in his initial attempt to break through and had to go back to the drawing board and lick his wounds, before ultimately achieving his actual aims. While this is certainly accurate, it is very difficult to assign a defeat to a commander who achieved his strategic objective quite decisively in the end, and with a complete tactical victory to boot. From the get-go, Alexander's strategic objective was to take a part of his army and get through what he believed to be the quickest route to get to his destination for the strategic aim of capturing the Persian treasury before it could be moved or looted. Based on this prime objective, he had to limit his options (split the army and take it the quickest perceived route; albeit through an easily defendable pass) and this put him into a situation that was a calculated risk against a calculated objective. That it was not a cake-walk should not be held against him as a defeat, in fact it is probably even more of a demonstration of his tactical abilities that after initially being stopped he compensated and went on to a pretty bold and overwhelming victory over a very entrenched, very determined and very capable opponent.
Besides this, after his initial repulse, the tactical victory was certainly complete. The outflanking manoeuvre and subsequent removal of this well-fortified position was a total success. As per Arrian towards the conclusion of his stratagem:
"For Alexander had expected to happen just that which did happen; and so had left Ptolemy there with some three thousand infantry, so that the greatest part of the Persians were cut down by the Macedonians at close quarters. Even those who were attempting flight, and the flight had become a panic, threw themselves over the cliffs and perished; but Ariobarzanes himself with a handful of horsemen escaped to the hills." III 18.7-11
Even Curtius, who seems to take a bit of glee in his "arrest of his good fortune" at least concludes with "the complete rout of the Persians had declared him the victor..." and thus Diodorus: "Coming into sight of the enemy outposts, he cut down their first line and captured those who were stationed in the second position, then routed the third line and won the pass, and killed most of the troops of Ariobarzanes." XVII 68. 5-69
I personally particularly enjoyed J.F.C. Fuller's analysis of this campaign in the Generalship of Alexander the Great, and I think his concluding summary paints a fair picture:
"Thus ended one of the most hazardous, audacious, and certainly most profitable of mountain campaigns in the annals of history."
When we speak of Thermopylae, we don't say that the Greeks won this battle. Sure, they put up a decent fight and held them off, but eventually they did lose, it is more of a moral victory than anything else, and I think it's something along the same lines here.
So, to summarize, it seems to me that a commander that achieved his strategic objective alongside an impressive tactical victory should not have a defeat laid at his door.