Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Appium returns 'The requested resource could not be found' (404)

ErrorMessage: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource

Short answer

The client is calling a URL the server does not serve. Appium 2 and later listen at the root path, not at /wd/hub, unless you start the server with a base path. Point the client at the same path the server uses, or start Appium with --base-path=/wd/hub.

  • Applies to Appium 2 and later, Node.js 22
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Compare two things: the server URL your test code uses, and the flags Appium was started with (especially --base-path).

    ps aux | grep -i "[a]ppium"
    grep -rn "4723" .
  2. 2Match what you see, then jump to its fix

    1. 1Your code connects to http://localhost:4723/wd/hub, and Appium was started without a base pathThe client still uses the Appium 1 address /wd/hubFix
    2. 2Appium was started with --base-path (or a config file sets it) and the client URL has no such prefixThe server has a custom base path the client does not useFix

What does the error look like?

  • Message: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
  • http://localhost:4723/wd/hub

Cause 1 of 2

The client still uses the Appium 1 address /wd/hub

1Check

In Appium 1 the default server URL ended in /wd/hub. In Appium 2 the default base path is empty, so the server answers at http://localhost:4723/ and /wd/hub returns 404.

grep -rn "wd/hub" .

2Fix

Change the URL in your tests to the root, or restore the old prefix on the server.

# client: use http://127.0.0.1:4723/
# or keep the old URL and start the server like this:
appium --base-path=/wd/hub

3Verify

Start a session; it no longer fails with 404.

grep -rn "4723" .

Confirmed by appium.io

Did this fix it?

Cause 2 of 2

The server has a custom base path the client does not use

1Check

The --base-path option sets the prefix for all webdriver routes on the server. The default is an empty string, so any other value must also appear in the client URL.

ps aux | grep -i "[b]ase-path"

2Fix

Use one base path on both sides: either add the same prefix to the client URL, or start the server without the flag.

# server started with:  appium --base-path=/automation
# client URL must be:   http://127.0.0.1:4723/automation

3Verify

A new session starts through the client URL.

ps aux | grep -i "[a]ppium"

Confirmed by appium.io

Did this fix it?

How do I stop it coming back?

  • Keep the Appium URL in one config value that every test reads.
  • Use current Appium clients and Appium Inspector, which add the appium: capability prefix for you.
  • Note the base path in your CI start script next to the appium command.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

Expo says it is unable to find expo in this project

Unable to find expo in this project - have you run yarn / npm install yet?

The Expo CLI ships inside the expo package, so the project must have expo as a dependency and installed in its own node_modules.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.