In Chapter 4 of The Swiss Family Robinson, Ernest’s “bad habit” is the habit of being lazy. We see this about midway through the chapter.
The Swiss Family Robinson is very much a book that is meant to inculcate Christian belief and a set of values that the author believes in. The father of the family is constantly trying to teach his children lessons so that they will revere God and will have good habits. We see this in his interactions with Ernest in Chapter 4.
About midway through Chapter 4, the father wants to go back to Tentholm to see what they can bring back from the things they have stored there. He arises early and wakes Ernest up. He does this as a means of teaching Ernest a lesson. As the father narrates,
I awoke early and roused Ernest as my assistant, wishing to encourage him to overcome his natural fault of indolence.
Indolence is essentially the same thing as laziness. This shows us that Ernest’s bad habit is the habit of being lazy. Ernest acknowledges that he is lazy and resolves to fix his fault, saying
Oh, father, do not laugh at my laziness! Indeed I mean to cure myself of it.
As the chapter goes on, it is not clear how much Ernest is actually working on correcting his fault. He figures out a way of preventing the animals from wandering off so he does not have to work so hard taking care of them. He also catches a large salmon when his father thinks he is goofing off. However, we will have to see how/if Ernest truly cures himself of his bad habit of laziness in the rest of the book.