In Japan, however, just such a machine has become a huge hit with bug collectors - and conservation groups fear it may set a disturbing precedent for the sale and mistreatment of living creatures.

Gathering live insects has a long tradition in Japan, where they are used to teach children about nature. Each summer, school parties head into the parks and forests in search of cicadas, beetles, fireflies and praying mantis.

But with the insects' wild habitats disappearing and most Japanese children now living in cities, Mirai Seiko, a company in the centre of the country, has started selling live kabutomushi (horned beetles) in vending machines.

The four machines, which are normally used for fresh vegetables, are as easy to use as coin-operated lockers. Customers place 400 yen (£2.10) in a slot and open a small door to acquire a pair of three-inch bugs in a box.

The marketing ploy has proved a huge success, with about 1,500 beetles sold in July. According to one magazine, the machines sold out each day within minutes of being filled. Some customers travelled more than 100 miles to make a purchase.

There is one vending machine for every 30 people in Japan, where the combination of technology, convenience and anonymity has proved a winning formula for everything from sake to sex aids.

Conservationists complain, however, that automated bug sales are a step too far and teach children that living creatures are of no more value than tamagotchi electronic pets.

"Treating living creatures in the same way as soft drinks and cigarettes sets a terrible example for children," says Aki Shiotsubo of the Citizens' Group to Preserve Nature and Protect Animals. "This belittles the value of life and we want it stopped. Beetles are not tamagotchi."

But the machines' owners claim their devices are good for the beetles as well as for business. "Opponents don't know what they are talking about," says Hirofumi Koeda, who is in charge of the sales.

"We feed the beetles before they are put in the temperature-controlled machines and they stand a better chance of survival there than in pet shops or department stores, as there is less stress and movement."

He claimed that only two of the beetles, 0.1% of the total, had died, compared with a 20% fatality rate in shops.

Yuri Shirai of the Animal Welfare Association argued that such figures were misleading. "The problem with the machines is that they cannot tell the owners how to treat the beetles, so the creatures are more likely to die after they are taken home".

According to the Gekkan Mushi (Bug Monthly) magazine, tens of thousands of people raise beetles as pets, with interest having risen sharply since the start of the decade.

This has created a lucrative market. In the Tobu department store in Tokyo, a pair of rare okuwagata - huge stag beetles - captured from the wild are on sale for 5m yen (£26,000).

Misaki Katsutoshi , who has sold beetles at Tobu for more than 10 years, said he would never put such valuable bugs in a vending machine, but he was not opposed to automated sales on principle.

"You would have to check the insects every day to ensure they were at the right temperature and had enough oxygen and food, but they might actually like it in a machine because they seem to be comfortable in dark, narrow spaces."