Troubleshooting Lengthy Shortcuts

Shortcuts can become quite lengthy, and troubleshooting a problematic shortcut can be frustrating. For those new to the Shortcuts app, I thought I would briefly mention a few approaches that can be helpful.

The approach I use most often involves the Show Content action, which previews input received from another action. The content of the preview varies and can be the first page of a PDF, the name of a folder, or the items in a list. In the following example, the result of a calculation is displayed.

A similar approach is the Stop and Output action. The primary difference is that the input is previewed in the Shortcuts Editor at the end of the shortcut instead of a dialog.

A shortcut error can often arise from a magic variable not referencing the intended action. In the following example, the third action has two magic variables and they both incorrectly reference the first action of the shortcut (i.e. the number 10). Magic variable reference errors are easily checked by clicking on the magic variable, which displays the Variable Editor. You can then click on the Reveal button, and the Shortcuts Editor will show and faintly (too faintly IMO) highlight the referenced action.

Magic variable reference errors can also be checked by naming magic variables (which is a good idea anyways). In the following example, the default name for both of the magic variables in the Calculate action is Number. I renamed the first magic variable to The Number 10 and the second magic variable was also renamed to The Number 10. This made clear a reference error.

After fixing the reference error, I renamed each Magic Variable as follows:

Another possible troubleshooting tool is the Show Content Graph action. The stated purpose of this action is to show “the results of the previous action in the Content Graph.” I can’t say I use this action much, but the following is an example of its operation.

Finally, consulting the documentation can be helpful. Each action has an Info pane which explains the operation of the action. These are normally brief but can be somewhat detailed.

The Shortcuts User Guide is excellent and can be found here.