<!--
{
  "availability" : [
    "macCatalyst: 14.0.0 -",
    "macOS: 10.7.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Automator",
  "identifier" : "/documentation/Automator/AMAction/finishRunningWithError(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Automator"
    ],
    "preciseIdentifier" : "c:objc(cs)AMAction(im)finishRunningWithError:"
  },
  "title" : "finishRunningWithError(_:)"
}
-->

# finishRunningWithError(_:)

Causes the action to stop running and return an error, which, in turn, causes the workflow to stop.

```
func finishRunningWithError(_ error: (any Error)?)
```

## Parameters

`error`

The error to be returned to Automator.

## Discussion

Call this method on any action that overrides [`runAsynchronously(withInput:)`](/documentation/Automator/AMAction/runAsynchronously(withInput:)) in order to make asynchronous calls. When [`finishRunningWithError(_:)`](/documentation/Automator/AMAction/finishRunningWithError(_:)) is invoked, it immediately calls [`willFinishRunning()`](/documentation/Automator/AMAction/willFinishRunning()).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)