Sanitize command name and ensure it exists