WITH their pristine rooms and green courtyard, the new psychiatric clinic and geriatric and dermatological wards cost $19m. But what the hospital in Bydgoszcz in north-west Poland does not have is enough nurses and carers. As a result it can only fill half of its 236 beds. Such labour shortages are common in eastern Europe. Construction, manufacturing and technology firms are struggling to find enough workers. And shortages are likely to get worse as populations age rapidly.

Meanwhile, eastern European governments have been among the most vocal opponents of plans to relocate refugees across the EU. Poles and Czechs have joined Hungarians in refusing to accommodate migrants, who are often young and educated. This ignores economic logic.

A survey by ManpowerGroup, a consultancy, found that two out of five firms in Poland struggle to fill vacancies. In Hungary, almost half could not get the staff they need. In the Czech Republic and Slovakia fewer employers report difficulties (18% and 28%) but the share has been climbing steadily over the past few years.

IT firms, which face a crunch everywhere in Europe, struggle the most. Their best employees are lured to western Europe or America by higher salaries. Poland may be thriving as a back office for European business, but in 2014 it needed 50,000 more IT workers than it could find. In Slovakia, the 50,000-strong IT sector could expand by 10,000 overnight if people were available. “The education system is good at producing scientists, but not coders,” says Radovan Durana, an economist at the Institute of Economic and Social Studies in Bratislava. In Hungary, it is engineers who are in particularly short supply. Although Budapest is cheaper than Berlin, many graduates move to Germany, where pay is 150% higher.

So far skill shortages have not stopped national economies from growing. Poland and Hungary will expand by around 2.8-3.3% this year. But they could do much better. GDP per person in 2014 was less than 68% of the EU average. Labour shortfalls also increase pension deficits and leave holes in public finances.

Many eastern countries are failing to reach their considerable potential. Slovakia produces nearly 1m cars per year, the most per capita in the world. In August, Jaguar Land Rover announced plans to open its first continental European plant near the city of Nitra, costing €1.4 billion ($1.6 billion) by 2018. Local suppliers should be among the main beneficiaries, but a survey by PwC, a consulting firm, found that nearly 80% already lack skilled labour.

The public sector is no better off. Poland has five nurses per 1,000 inhabitants—compared with 13 in Germany. Of those only 1% are under 25, and 29% are due to retire by 2022. The average age among specialist doctors is 55. Maciej Hamankiewicz, president of Poland’s Supreme Medical Council, warns that patients may not receive proper care.

In Hungary, the crisis in the health system is even worse. Some 40% of doctors are over 60 and more than 200 medical practices have no doctor at all, mostly in the poorer eastern and northern regions. At Almasi Balogh Pal Hospital in Ozd, 55 doctors work nonstop to serve a city of 80,000 people. A hospital director says adverts for recruits get no response.

Reality check

It is Panglossian to expect refugees from far away to plug skill gaps instantly. Reliable data on what migrants know how to do are scarce. However, there is ample evidence that Syrians, the single largest group of arrivals, are relatively well-educated. Many Syrian doctors were trained in the Soviet Union and speak fluent Russian. Within minutes at one Budapest train station an Economist correspondent came across a Syrian lawyer, a mechanical engineer, an agricultural engineer and a physics teacher, all of whom spoke good English.

Even less capable refugees could have plenty of jobs to choose from. The Polish ministry of labour has identified large shortages of manual workers in agriculture and construction. The Hungarian economy ministry points to demand for carpenters, shop assistants, gardeners and bakers. Poland is already importing tens of thousands of seasonal workers from neighbouring Ukraine.

As populations age, workforces will keep shrinking. In Hungary birth rates are declining and lifespans are stretching. Many of the young emigrate. The population is forecast to shrink by 8% between now and 2035, while Poland faces a shrinkage of 6% (see chart). These figures still underestimate the problem, since official forecasts take people registered in a census as the baseline population, even though many live abroad and may not return.

Some eastern European officials insist they can fill skill gaps by drawing in labour from neighbouring countries with cultures more similar to their own, such as Bulgaria and Romania, which are EU members but not yet part of the Schengen travel zone. That too may be wishful thinking. Bulgarians and Romanians can already move around freely in Europe if they show their passports, and few head for other former Warsaw Pact countries. Meanwhile, both countries’ populations are ageing fast.

In the Balkans, wages are often lower than farther north, and employment in Poland or Hungary may seem attractive. But populations in the former Yugoslavia are old and shrinking; many of the young have already left. In Bosnia and Herzegovina the population was 4.4m in 1991, but now is 3.8m, and by 2050 the UN predicts it will fall by a further fifth, to 3.1m.

Immigration critics are right that integrating outsiders into countries with difficult languages and fragile public services is hard. But the rewards are obvious. “Poland is not likely to catch up with the West without opening up to foreign workers,” says Marcin Piatkowski, an economist at the World Bank.