As far as I know, when borrowing debt, they also take GDP (gross domestic gross) into account. when the debt is still below the GDP owned by a country, the debt is safe. If you look at the list, many large countries have debt, because they of course have a development agenda that must be carried out immediately so that in the long term it can be useful for their society. However, if income does not match debt then a crisis could occur in that country. I am also not an economist, but in general, debt is needed to encourage the acceleration of policies to improve the welfare of the people.