After the messup with Achan, the Israelites learned their lesson, right? Well, almost.
The peoples of the land of Canaan were afraid…and rightfully so. The Israelites were a conquering force with the God of heaven and earth on their side. The people of Gibeon decided to trick the Israelites, and they did because Joshua and the leaders did not consult the LORD. They made a treaty with Gibeon without knowing that they were neighbors. But a promise/treaty is a promise.
Later, the Gibeonites were attacked by the five kings of the Amorites because they had made a treaty with Joshua and the Israelites. And because of the treaty, the Israelites had to come to their rescue. But God was with them and helped them.