It's "The Necessary ThingThe Necessary Thing" by Robert Sheckley.
Gregor sends Arnold out for supplies for their next job, but Arnold returns having spent the money on another item from Joe the Interstellar Junkman.
Their ship breaks on landing, and when they try to order parts from the machine (called Configurator) they discover it's flaw.
"That's interesting. I suppose someone should have thought of that possibility." "What possibility?" "Apparently the Configurator will turn out anything," Arnold said. "But only once."