Sounds absolutely grand. But how did it fail?
There's a really fantastic 6-part documentary that goes over the conflict in great detail, but to give the short version:
It failed for a multitude of reasons, but when I did my own deep dive on this, I didn't find Anarchism itself as one of those reasons. I found that the specific time it took place, as well as the previous industrial capacity of Spain itself, were likely two of the biggest contributors.
The civil war occurred during a period when there were powerful states on the world stage, Nazi Germany and Fascist Italy, who were ready and willing to supply needed logistics and manpower to other right-wing states. It also happened when both of those states were not yet embroiled in their own world war, giving them the opportunity to send more resources and aid than they would've have been able to justify a handful of years later.
On the other hand, the Anarchists (and Liberals) of Spain had no allies on the world stage willing to help them besides some meager aid from Mexico (who lacked the ability to send airplanes or tanks), and a few secret shipments of aid from France.
The only other nation willing to get stuck in was the USSR, and they obviously only wanted to supply the marxist-leninist faction in Spain to ensure they would have control at the end of the war.
So if you consider the scenario from the Anarchist perspective, what could be done? They were fully aware that the Lenininsts would likely betray them due to what happened in the Russian Revolution, but they were also the only faction that could convince the USSR to ship desperately needed tanks, planes, artillery, firearms, medical supplies, etc, in the numbers needed.
So they had to decide; Do we attack the Leninists at the start of the war before they are equipped? That would cut off all future logistical aid and create a second front in all of the cities, probably ceasing production of the supplies they can build, supplies which are already needed to sustain the conflict with the fascists, and it would probably get the liberal government to denounce the Anarchists as well, resulting in them vs. literally everyone. It would be speed-running defeat.
Instead, they went the path they did, likely hoping for a future opportunity to come out on-top after the fascists had been defeated, instead of guaranteed defeat immediately.
The Anarchists knew this was an uneasy alliance, they knew they would be betrayed at some point, and they saw the liberal government shuffling its feet whenever they asked it for help. There was even discussion among the Anarchists on robbing the gold reserves of the Spanish national bank and buying supplies themselves, instead of relying on the liberal government to do so, but they ultimately decided not to to avoid more internal conflict after the liberal gov seemed to be following through on buying some weapons for the Anarchists. That unfortunately backfired when the government shortly after went back on their word, and instead gave all the gold to the USSR.
Even knowing that the Marxists would betray them, I don't think they expected that to happen while the fascists were nowhere close to being defeated, as starting internal conflict would only ensure their collective defeat, but... The Marxists did it anyway, which was unexpected, and it did hasten their defeat.
The other issue was that Spain simply hadn't developed enough military industrial capacity before the war to avoid being so reliant on foreign logistics. As General Pershing supposedly once said, "Infantry win battles, logistics win wars." That's ultimately why the allies were able to defeat the Axis in WWII as well, since the combined industrial and logistical capacity of the allies (especially with the introduction of the US's industrial capacity), simply become overwhelming.
Any system or ideology in the same circumstances as the Anarchists in Spain is not going to have good odds of succeeding.
In comparison, the Russian Revolution happened when the neighboring countries who could've stepped in to take advantage of the conflict were already militarily depleted from WWI, so the right-wing White army was pretty much on their own, which made it much easier for the combined Anarchist/Marxist armies to defeat them. The Anarchists at that time were pretty blind-sided by the betrayal of the Leninists, since leftist back-stabbing was fairly unprecedented at that time.
Continuing in another comment.