It puzzles me why David went to Gath. It is a crazy thing to do, another Philistine city perhaps but Gath? Carrying Goliath's sword? Yet we learn that Ahimelech sought the Lord for David from Doeg the Edomite and from Ahimelech himself. Moreover Ahimelech had sought the Lord on David's behalf before. What then was the answer? If we take the actions of David to be in obedience to God then he was told to go to Gath. Once there however he was seized rather than feted and faith gave way to fear. In that moment David switched from offering his services to feigning madness. This I think is where David "failed" - his faith could not keep pace with God's protection. This all seems speculative and flies in the face of most commentators: until we read chapter 27 when David returns to Achish's court and is well received. Moreover in the providence of God David is able to fight the Philistines and pass off the captured booty as Hebrew in origin. Can you refute me from the text?