Error: Site not found. Verify DOMAIN_CURRENT_SITE matches

I am getting the following error when attempting to deploy my multi-site setup. I’ve successfully deployed in the past but now I’m attempting to setup domain mapping to the sub-site and now I get this error:

Error: Site 'domainofsubsite.com/' not found. Verify DOMAIN_CURRENT_SITE
matches an existing site or use `--url=<url>` to override. failed: [XXX.XX.XX.XXXX] 
(item=template_root) => 
{"changed": false, "cmd": " wp site list --field=url | xargs -I {} bash -c 'export url=\"{}\"; echo -n \"$url \" 
&& wp option get template_root --skip-plugins --skip-themes --url=$url || echo'\n ", "delta": 
"0:00:00.194381", "end": "2018-03-19 22:05:12.966420", "failed": true, "failed_when_result": true, "item": 
"template_root", "rc": 0, "start": "2018-03-19 22:05:12.772039", "stderr": "Error: Site 
'domainofsubsite.com/' not found. Verify DOMAIN_CURRENT_SITE matches an existing site or use `-- 
url=<url>` to override.", "stdout": "", "stdout_lines": [], "warnings": []}

I am lost as to why this is happening.

The domain with the ending “/” cannot be found anywhere in my database or in any of the code for the site. My searching of the web doesn’t bring any solutions.

That task only needs to run if you are using one of the themes from WP core. If you are using Sage or a custom theme, try this note from roots/trellis#854:

To disable: Multisite operators who wish to avoid the processing time may define update_wp_theme_paths: false in a group_vars file or on the fly:

ansible-playbook deploy.yml -e env=production -e site=example.com -e update_wp_theme_paths=false

Otherwise, you could add -vvv to your deploy command and see the exact wp-cli command the task is running, ssh in to the server as web_user, cd /srv/www/example.com/current and run the command, and troubleshoot from there.

You could also double-check the multisite docs for any missed detail (I miss those details all the time).

1 Like

Thank you sir. That fixed the error and allowed me to continue to deploy.

1 Like

Let’s open this one back up.

I’m receiving the same error after changing my development extension from .dev to .test and running vagrant provision.

I need to do this as all browsers are no longer allowing me to run a .dev extension.

non-zero return code
Error: Site 'trellis.website.test' not found. Verify `--url=<url>`
matches an existing site.
failed: [default] (item=website.com) => {"changed": true, "cmd": ["wp", "option", "update", "home", 
"http://trellis.website.test", "--allow-root"], "delta": "0:00:00.208233", "end": "2018-04-03 
21:04:23.358520", "failed": true, "item": "website.com", "rc": 1, "start": "2018-04-03 21:04:23.150287", 
"stderr_lines": ["Error: Site 'trellis.website.test' not found. Verify `--url=<url>` matches an existing site."], 
"stdout": "", "stdout_lines": []}

Not sure how to fix it.

Looks like I fixed this by manually updating the URLs in wp_blogs to the new .test extension.