Beckhoff TwinCAT 2 Automation Interface
12 fault codes documented
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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).
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.