# US 12,222,802 B2 · Failure recovery recommendations for CLI commands

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 12,222,802 B2
- Document ID: US12222802B2
- Status: Granted
- Kind: B2
- Application number: 18/525,828
- Filed: 2023-11-30
- Published: 2024-04-11
- Granted: 2025-02-11
- Earliest claimed: 2020-09-22
- Assignees: Microsoft Technology Licensing, LLC
- Applicants: Microsoft Technology Licensing, LLC.
- Inventors: Christopher O'Toole; Roshanak Zilouchian Moghaddam
- Web page: https://patentgrep.com/patent/US12222802B2

## CPC

- G06F 9/453: {Help systems}
- G06F 11/0793: {Remedial or corrective actions (recovery from an exception in an instruction pipeline G06F9/3861; by retry G06F11/1402; for recovering from a failure of a protocol instance or entity H04L69/40)}
- G06F 11/0709: {in a distributed system consisting of a plurality of standalone computer nodes, e.g. clusters, client-server systems}
- G06F 11/0751: {Error or fault detection not based on redundancy (power supply failures G06F1/30; network fault management H04L41/06)}
- G06F 11/0772: {Means for error signaling, e.g. using interrupts, exception flags, dedicated error registers}
- G06F 11/327: {Alarm or error message display}
- G06F 18/214: Generating training patterns; Bootstrap methods, e.g. bagging or boosting
- G06N 7/01: Probabilistic graphical models, e.g. probabilistic networks
- G06N 20/00: Machine learning
- G06N 20/20: Ensemble learning
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

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.

## Claims

### Claim 1

A system comprising:
one or more processors coupled to a memory; and
a program stored in the memory and configured to be executed by the one or more processors, the program including instructions that:
detect a plurality of failure-success pairs of command line interface (CLI) commands from historical usage data, a failure-success pair including a successfully-executed CLI command immediately following a failed CLI command;
compute a probability for a failure-success pair, the probability representing a likelihood that the successfully-executed CLI command remediates the failed CLI command of the failure-success pair; and
select a successfully-executed CLI command, of a failure-success pair, to remediate a failed CLI command based on an associated probability.

### Claim 2 (depends on 1)

The system of claim 1, wherein the program includes further instructions that:
associate a failure type to each of a plurality of failed CLI commands; and
select the successfully-executed CLI command to remediate the failed CLI command based on the failure type of the failed CLI command matching the failure type of the successfully-executed CLI command.

### Claim 3 (depends on 2)

The system of claim 2, wherein the program includes further instructions that:
train a failure type classifier to associate a failure type to an error message, the error message including the failed CLI command.

### Claim 4 (depends on 3)

The system of claim 3, wherein the probability associated with the failure-success pair is based on a frequency of the successfully-executed CLI command immediately following the failed CLI command.

### Claim 5 (depends on 1)

The system of claim 1,
wherein a successfully-executed CLI command includes a parameter having a parameter value; and
wherein the program includes further instructions that:
select a parameter value for the parameter based on a data type of the parameter value.

### Claim 6 (depends on 5)

The system of claim 5, wherein the data type of the parameter value is identified from a parameter value type classifier, the parameter value type classifier trained to identify a data type of a parameter value from publicly-accessible examples.

### Claim 7 (depends on 5)

The system of claim 5, wherein the program includes further instructions that:
select the parameter from a parameter set associated with the successfully-executed command based on a highest frequency associated with the selected parameter.

### Claim 8

A computer-implemented method, comprising:
obtaining a plurality of failure-success pairs, a failure-success pair including a failed CLI command and a successfully-executed CLI command, wherein the successfully-executed CLI command immediately followed a failed CLI command in historical usage data of the CLI;
receiving an error message from a failed CLI script, the failed CLI script including a first failed CLI command;
selecting a successfully-executed CLI command to remediate the first failed CLI command based on the first failed CLI command matching the failed CLI command of the selected successfully-executed CLI command; and
forming a recommendation to remediate the first failed CLI command, the recommendation including the selected successfully-executed CLI command.

### Claim 9 (depends on 8)

The computer-implemented method of claim 8, further comprising:
associating a failure type with each failed CLI command of the plurality of failure-success pairs; and
selecting the selected successfully-executed CLI command based on a failure type of the first failed CLI command matching a failure type of the selected successfully-executed CLI command.

### Claim 10 (depends on 9)

The computer-implemented method of claim 9, further comprising:
training a failure type classifier to associate a failure type given an error message having a failed CLI command.

### Claim 11 (depends on 10)

The computer-implemented method of claim 10, wherein the failure type classifier is a random forest classifier.

### Claim 12 (depends on 8)

The computer-implemented method of claim 8, further comprising:
ranking failure-success pairs associated with a common failure type by increasing frequency.

### Claim 13 (depends on 8)

The computer-implemented method of claim 8, further comprising:
associating a set of parameters with the successfully-executed command of a failure-success pair, the set of parameters derived from historical usage data.

### Claim 14 (depends on 13)

The computer-implemented method of claim 13, further comprising:
determining a data type of a parameter value for a select parameter of the set of parameters; and
using the data type of the parameter value of the select parameter to obtain a selected parameter value.

### Claim 15 (depends on 13)

The computer-implemented method of claim 13, further comprising:
training a classifier to identify the data type of the parameter value from command-parameters pairs of the historical usage data.

### Claim 16

A device, comprising:
at least one processor coupled to a memory;
wherein the at least one processor is configured to:
detect a failure of a command of a command line interface to execute successfully;
determine a failure type of the failed command;
generate a recommendation to correct the failed command from a conditional probability model given the failed command and the failure type, the recommendation including a success command to remedy the failed command, the conditional probability model predicting the success command based on a probability of the success command immediately following the failed command; and
output the recommendation to a user device having initiated the failed command.

### Claim 17 (depends on 16)

The device of claim 16, wherein the at least one processor is further configured to:
receive an error message indicating the failed command; and
utilize a failure type classifier to determine the failure type of the failed command.

### Claim 18 (depends on 17)

The device of claim 17, wherein the at least one processor is further configured to:
generate an embedding of the error message of the failed command using a bag-of-words model, the embedding used by the failure type classifier to predict the failure type.

### Claim 19 (depends on 17)

The device of claim 17, wherein the failure type classifier is a random forest classifier.

### Claim 20 (depends on 16)

The device of claim 16,
wherein the success command includes a parameter having a parameter value,
wherein the at least one processor is further configured to:
obtain a data type of the parameter value from a parameter value type classifier; and
select the parameter value from a plurality of parameter values of the success command based on the data type of the parameter value.
