Beckhoff TwinCAT 2 Automation Interface

12 fault codes documented

E_ACCESSDENIED

Access Denied

The operation failed due to insufficient permissions or a locked resource. This occurs if the current document in the system manager instance is locked (e.g., when calling NewConfiguration() or OpenConfiguration()) because a reference to the system manager's object or a tree element is open. For DeleteChild(), it indicates that deleting the child item is not allowed due to protection or operational constraints.

E_FAIL

General Function Failure

The operation failed for an unspecified reason, indicating a general failure. This could happen during NewConfiguration() or ActivateConfiguration(), StartRestartTwinCAT() if the TwinCAT system cannot be started, or ConsumeXml() if the provided XML string is not a valid document.

E_INVALIDARG

Invalid Argument Provided

An invalid argument was supplied to the function. For OpenConfiguration(), the bstrFile path does not refer to a valid TwinCAT configuration file. For SaveConfiguration(), the bstrFile path is invalid for saving. For LinkVariables(), the offs1, offs2, or size parameters do not match the variables' structure or range.

E_NOTSUPPORTED

Operation Not Supported in Current Mode

The attempted operation, specifically NewConfiguration(), OpenConfiguration(), or SaveConfiguration(), is not supported in the current TwinCAT Automation Interface operational mode. These methods are exclusively available when the Automation Interface is running in Compatibility Mode.

E_POINTER

Invalid Pointer

An invalid pointer was provided to the function. For ProduceXml(), this applies to the output pXML parameter, indicating the variable to store the XML string is not properly allocated. For CreateChild(), this means the pipItem pointer, intended to receive the new child item's interface, is invalid, preventing the successful creation and return of the child item.

NTE_BAD_SIGNATURE

Invalid Import File Signature

The file specified for import does not contain a valid tree item or has a corrupted signature (0x80090006). This error occurs when ImportChild() attempts to read the file but determines its content is not a recognized TwinCAT tree item export format.

NTE_NOT_FOUND

Import File Not Found

The specified file for importing a child item cannot be found or opened (0x80090011). This indicates an issue with the path to the import file or its accessibility, preventing the ImportChild() operation from completing.

TSM_E_CORRUPTEDLINK

Corrupted Variable Link

The specified variables cannot be unlinked, possibly due to a corrupted or invalid link definition in the TwinCAT configuration (0x98510005). This indicates an issue with the integrity of the variable linkage data within the system.

TSM_E_INVALIDITEMSUBTYPE

Invalid Item SubType for Creation

The provided nSubType parameter for creating a child item is invalid or not compatible with the parent item's type (0x98510003). The usable subType depends on the parent tree item's category; for example, a PLC Functionblock may only be added to a PLCFOLDER item, not a DEVICE item.

TSM_E_INVALIDITEMTYPE

Invalid Tree Item Type for Operation

One or both of the specified tree items are not valid for the attempted operation (0x98510002). For LinkVariables() or UnlinkVariables(), this means one or both tree items are not of a variable type, preventing linkage operations.

TSM_E_ITEMNOTFOUND

TwinCAT Tree Item Not Found

The specified tree item could not be found using the provided identifier (0x98510001). This can occur with LookupTreeItem() (absolute path name), LookupTreeItemById() (itemType/itemId combination), LookupChild() (relative path name), CreateChild() (bstrBefore item not found), DeleteChild() (bstrName item not found), ExportChild() (bstrName item not found), or ChangeChildSubType() (bstrChild item not found).

TSM_E_MISMATCHINGITEMS

Mismatching Items for Operation

The items involved in the operation are incompatible (0x98510004). For LinkVariables(), this occurs when two variables cannot be linked due to incompatible data types, attempting to link two outputs, linking an output of a task to an input of a device, or linking variables of the same owner. For ImportChild(), this means the tree item contained within the import file is not a valid child item for the current parent, or its structure is incompatible.

Beckhoff TwinCAT 2 Automation Interface Fault Codes — Complete Error List | ErrorLib