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.
Since the total income and expenditure of a country's economy is calculated and the loan is accepted, if ever there is a discrepancy with the income and expenditure, then an economic crisis can definitely occur. Many people may wonder why many countries are taking loans even though they have good economic support, if a country has enough opportunities to take loans then why would that country refrain from taking loans. The amount of money that a country can take a loan, that amount of money can be spent on any developmental work of the country by taking a loan, as a result of which the country's economic condition can change greatly if the country develops, basically big countries take loans by thinking about all this.