In Star Wars movies, in almost every episode, people who are familiar with the power of the Force and the fact that people strong with the Force can become aware of the presence of a person, will usually go to a place and end up alerting that one bad guy there which can result in the death of said character and even endanger the success of the resistance plan.
This is a weak example, I know (Obi-Wan didn't plan to go to the Death Star and probably wanted to face Anakin one last time in front of Luke). In A New Hope, Obi-Wan (a Jedi master) ventures out of the Falcon aware that should Darth Vader be present on the Death Star, he would definitely become aware of him and would so endanger the escape plan and even his life.
In Return of the Jedi, Luke is almost a Jedi himself when he goes to forest moon of Endor. He has already had a Force conversation with Vader and Leia and knows that Vader can become aware of his presence. Knowing this he goes to Endor and realizes Vader would know that he was there. He didn't know that emperor already knew about that, so it's quite risky given the whole resistance plan could fail because of him.
In The Force Awakens, Han makes the mistake of going to the StarKiller base, well aware of how the Force works. There is a little possibility that he doesn't know about this particular nature of the Force given that Leia might have tried to have a Force conversation with Luke countless times after he disappeared. Also, quite a number of years have passed. Given that the base is the main weapon of the First Order against the galaxy, it's a fair possibility that Ben would be there and would definitely know if Han is on the base. That would ruin the already fragile plan, Ben would know that Han wouldn't come to the base without a plan to destroy it or something. Han probably wanted Ben to be there, but he was definitely not prepared for Ben to know that beforehand and tighten the security or whatever.
So why does this keep happening?