Status code · Methods

BadMethodInvalid

BadMethod calls

BadMethodInvalid means the methodId you passed to Call is not a Method of the objectId you passed with it. The pairing is what fails, not the node itself. Browse HasComponent references from the object instance and take the method NodeId from there rather than from the type definition.

Defined behaviour: The method id does not refer to a method belonging to the specified object. (our description of the condition this code reports)

What you actually see

The method is clearly visible in the address space and readable in UaExpert, but every Call returns this code.

Why it happens

  • Method NodeId taken from the type, not the instanceA Method declared on an ObjectType is an instance declaration. Each object instance gets its own Method node when the modelling rule is Mandatory or Optional. Calling the type's method NodeId against an instance objectId is the single most common cause of this code.
  • objectId and methodId belong to different objectsCall takes both an objectId and a methodId and the server verifies that the method is a component of that object. Copying a method NodeId from one machine instance and pairing it with another machine's objectId fails this check even though both nodes exist.
  • The node is not a MethodIf the NodeId points at a Variable or an Object rather than a Method NodeClass, the server rejects it here. This happens when a browse result is indexed wrongly, or when a configuration file lists a folder node by mistake.
  • Namespace index drift after a download or upgradeA hardcoded numeric namespace index in the method NodeId can shift after a PLC program download or a server upgrade, so the identifier now resolves to a different node or to none. Resolve namespace URIs against NamespaceArray at connect instead.
  • Method reached through an Interface or an optional placeholderMethods inherited through an Interface, or declared under an OptionalPlaceholder modelling rule, may exist on some instances and not others. A client that assumes every instance of a type carries every method will hit this on the instances that do not.

How to fix it

In diagnostic order: work down, do not skip ahead.

  1. Browse the object instance for its methodsBrowse the objectId with browseDirection Forward, referenceTypeId HasComponent, includeSubtypes true and nodeClassMask restricted to Method. What comes back is the exact set of methodIds that are legal to pair with that objectId.
  2. Use TranslateBrowsePathsToNodeIds for the pairingGive the service the object's NodeId and the method's BrowseName as a relative path. It returns the instance method NodeId directly, which removes the whole class of type-versus-instance mistakes and survives namespace index changes.
  3. Read the NodeClass attribute before callingRead attribute NodeClass on your methodId and confirm it is Method. One extra read at startup turns a runtime service failure into a clear configuration error you can report properly.
  4. Resolve namespace indexes at connectRead NamespaceArray, build a URI-to-index map, and store namespace URI plus identifier in configuration rather than the raw ns number. This is the fix for the whole family of post-download NodeId failures, not just methods.
  5. Confirm the object is the method's parent, not its grandparentMethods are often components of a sub-object such as a management or control object rather than of the machine object you browsed to. Pass the immediate parent as objectId; the parent that owns the HasComponent reference is the only valid one.

Where it shows up, by tool and stack

Tool / stackWhat to do there
UaExpertRight-click the method node and choose Call to see the dialog with the correct object and method pairing already resolved. If UaExpert can call it and your client cannot, compare the two NodeIds it used.
asyncua (Python)Prefer obj.call_method("2:MethodName", *args) with a qualified BrowseName; asyncua resolves the instance method for you. Passing a Node built from a hardcoded string is where this code appears.
node-opcuasession.call({objectId, methodId, inputArguments}) validates nothing client-side. Use session.getArgumentDefinition(methodId) first: it fails informatively if the method NodeId is not a method.
UA-.NETStandard (C#)session.Call(objectId, methodId, args) surfaces this as a ServiceResultException. Use browse or the typed helpers to obtain the instance method rather than referencing an ObjectTypes or MethodIds constant.
Beckhoff TwinCATMethods exposed from PLC function blocks appear as components of the instance object generated for that block. Take the method NodeId from a live browse of the running configuration, since it changes when the PLC project is restructured.

What it looks like in the log

Call failed: BadMethodInvalid (objectId=ns=4;i=5012 methodId=ns=4;i=7003)
getArgumentDefinition: node ns=3;s=Machine.Reset is not of NodeClass Method

Confirm the fix

Call the method with the objectId and methodId that a fresh browse returned as parent and child, and confirm the CallMethodResult statusCode is Good. Repeat after a PLC download to prove the resolution is not index-dependent.

Stop it happening again

Resolve object and method NodeIds together at connect through TranslateBrowsePathsToNodeIds and store BrowseNames plus namespace URIs in configuration. Subscribe to GeneralModelChangeEvent so cached NodeIds are invalidated when the server's address space changes.

Stuck on more than one of these? The troubleshooting clinic works through broken configurations end to end, on camera.

Troubleshooting clinic →

Last verified 7 September 2026 against OPC UA 1.05.07. OPC UA Connect is an educational resource and is not affiliated with the OPC Foundation.

Free download
OPC UA Status Code Diagnostic Tree
A 15-page diagnostic reference grouping every normative status code by what actually went wrong: with the first action for each, and the four questions that resolve most faults before you read a single code.
Get the free diagnostic tree →
Free, no course, no login