A failure recommendation system for a command line interface (CLI) uses machine learning to predict the most likely command to correct an unsuccessful or failed attempt to perform an intended operation using the CLI. The failure recommendation system is based on a conditional probability model trained on failure-success pairs of commands from CLI telemetry data to learn the most likely command to remediate a failure. The conditional probability model predicts the most likely command based on a failure type and the failed command. The failure type is identified through a failure type classifier and is used to select the most likely command to remediate a failure from the different events that may lead to a failure.