"The situation is a test of President Donald Trump and his foreign-policy team, including the hawkish national security adviser, John Bolton. This week Mr Bolton hinted at the use of American troops. Barring state violence against American citizens, that would be a mistake." Does it mean that American forces would only be used against its citizens, otherwise it is illegal?
Thank you for editing in the additional context. "That would be a mistake" refers to "use of American troops."
"Barring" means except for or unless something happens. https://dictionary.cambridge.org/us/dictionary/english/barring
In this case, the sentence means "Unless there is violence perpetrated by the Venezuelan state against American citizens, it would be a mistake to use American troops."
A "mistake" doesn't necessarily mean illegal--it simply means the author thinks it's a bad idea.
Next time, please give us more context, and/or a link to the text where you found the sentence.
I found the article. I took an extremely brief glance and got the impression that the paragraph that contains your sentence is about whether the US should meddle/intervene in another country or not. That helped me understand the sentence. Here's the meaning, loosely:
Unless violence were perpetrated by the government of the other country against US citizens, intervening/meddling would be a mistake.