Encountered internal error running command: TypeError: Cannot destructure property 'alwaysMatch' of 'originalCaps' as it is undefined

[HTTP] --> POST /wd/hub/session
[HTTP] {“desiredCapabilities”:{“platformName”:“Android”,“automationName”:“UiAutomator2”,“deviceName”:“RZ5REV7EWG”,“App”:"/Users/apple/Desktop/XYZ/XYZ/Builds/Android/com.XYZ.XYZ.ZZZv3-7.apk",“appPackage”:“com.abc.pqr.xyz”,
”appActivity”:”sadadasdasda.SplashActivity”,“noReset”:true,“newCommandTimeout”:100000,“uiautomator2ServerLaunchTimeout”:100000}}
[debug] [AppiumDriver@1546] Calling AppiumDriver.createSession() with args: [{“platformName”:“Android”,“automationName”:“UiAutomator2”,“deviceName”:“RZ5REV7EWG”,“App”:"/Users/apple/Desktop/XYZ/XYZ/Builds/Android/com.XYZ.XYZ.ZZZv3-7.apk",“appPackage”:“com.abc.pqr.xyz”,“appActivity”:”sdafsdfsafasfsfasfsfa.SplashActivity”,“noReset”:true,“newCommandTimeout”:100000,“uiautomator2ServerLaunchTimeout”:100000},null,null]
[debug] [AppiumDriver@1546] Event ‘newSessionRequested’ logged at 1689336657812 (17:40:57 GMT+0530 (India Standard Time))
[debug] [AppiumDriver@1546] Event ‘newSessionStarted’ logged at 1689336657814 (17:40:57 GMT+0530 (India Standard Time))
[debug] [AppiumDriver@1546] Encountered internal error running command: TypeError: Cannot destructure property ‘alwaysMatch’ of ‘originalCaps’ as it is undefined.
[debug] [AppiumDriver@1546] at promoteAppiumOptions (/usr/local/lib/node_modules/appium/node_modules/@appium/base-driver/lib/basedriver/capabilities.js:424:10)
[debug] [AppiumDriver@1546] at AppiumDriver.createSession (/usr/local/lib/node_modules/appium/lib/appium.js:253:29)
[debug] [AppiumDriver@1546] at commandExecutor (/usr/local/lib/node_modules/appium/node_modules/@appium/base-driver/lib/basedriver/driver.ts:106:18)
[debug] [AppiumDriver@1546] at AppiumDriver.executeCommand (/usr/local/lib/node_modules/appium/node_modules/@appium/base-driver/lib/basedriver/driver.ts:123:15)
[debug] [AppiumDriver@1546] at processTicksAndRejections (node:internal/process/task_queues:95:5)
[debug] [AppiumDriver@1546] at defaultBehavior (/usr/local/lib/node_modules/appium/lib/appium.js:680:16)
[debug] [AppiumDriver@1546] at AppiumDriver.executeWrappedCommand (/usr/local/lib/node_modules/appium/lib/appium.js:774:16)
[debug] [AppiumDriver@1546] at AppiumDriver.executeCommand (/usr/local/lib/node_modules/appium/lib/appium.js:696:17)
[debug] [AppiumDriver@1546] at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/@appium/base-driver/lib/protocol/protocol.js:393:19)
[HTTP] <-- POST /wd/hub/session 500 34 ms - 658

Facing above issue when trying to run with Appium v2.0.0-rc.4 for C# code
I suppose last 2 arguments as null, null are the problem as it’s not taking Uri and creating driver
I am successfully able to launch app in Appium inspector with same capabilities

@Aleksei @wreed any suggestions are most welcomed.

Here is the documentation for Appium Capabilities, specifically the basic example:

https://appium.io/docs/en/2.0/guides/caps/#basic-example

Note the use of ‘appium:’ keyword on some of the capabilities, such as:

"appium:deviceName": "iPhone 11"

Whereas your log example:

“deviceName”:“RZ5REV7EWG”

In addition, I think you are missing capability: “appium:platformVersion”

Read the link, it will point you in the right direction.

Seems like you use an outdated client. Appium 2 and its drivers only support W3C protocol

@wreed @mykola-mokhnach Thanks for your valuable feedback. I’ll surely try and revert back with results.