  Extracting commonsense knowledge from a large language model (LLM) offers a
path to designing intelligent robots. Existing approaches that leverage LLMs
for planning are unable to recover when an action fails and often resort to
retrying failed actions, without resolving the error's underlying cause. We
propose a novel approach (CAPE) that attempts to propose corrective actions to
resolve precondition errors during planning. CAPE improves the quality of
generated plans by leveraging few-shot reasoning from action preconditions. Our
approach enables embodied agents to execute more tasks than baseline methods
while ensuring semantic correctness and minimizing re-prompting. In
VirtualHome, CAPE generates executable plans while improving a human-annotated
plan correctness metric from 28.89% to 49.63% over SayCan. Our improvements
transfer to a Boston Dynamics Spot robot initialized with a set of skills
(specified in language) and associated preconditions, where CAPE improves the
correctness metric of the executed task plans by 76.49% compared to SayCan. Our
approach enables the robot to follow natural language commands and robustly
recover from failures, which baseline approaches largely cannot resolve or
address inefficiently.
