Deleting site, Local does not let me use same domain

What issue or error are you experiencing?

After I delete a site (I skipped the recylcing bin), and add it again (from a ZIP file), Local does not let me use the same domain. It gives this error:

invalid domain
xxx.local is already taken by another site. Please choose a different domain

Why is this?

Hello @henkvz - thank you for your question!

Site domains are all stored in your private/etc/hosts file.

When you delete the site, whether or not you check the “move to trash” box, you should see something like this screenshot:

What this is asking is for Local to have permission to go to that file and delete any record of that site domain. If you happened to hit cancel, or just didn’t see the prompt, or just closed it, Local never goes in and actually cleans up the record of that site domain.

That said - here’s what you can do:

  • In the future, make sure to allow that access to the prompt when deleting sites.

  • For this instance - you could manually edit the hosts file (be careful!) and just remove any lines that have references to the domain that they’re no longer using and hit save. If you do this I would highly recommend making a backup of that hosts file.

Here’s an example:

“sitedomaintodelete.local” has been created. Opening the hosts file by navigating to the path above, here is the file. These 4 lines should be deleted:

Again, I would make a backup of the private/etc/hosts file before doing any of this.

Let me know if this helps!

Sam

I have never seen any password screen?! I never set a password as well. How, what?

Is this the iOs password perhaps? I’m on Windows.

I have no private/etc/hosts as far as I can see.

Hi @henkvz

On Windows you’ll want to make sure that Local has permissions and isn’t being blocked by any other programs. You can start by checking here:

If you’re still having trouble do you have any other antivirus, security, or firewall applications that could be blocking Local?

I found the hosts file. But it wasn’t read-only, and I have no anti-virus.

Also, the domain I deleted was not in the hosts file. Yet, it won’t let me create that domain.

In order to refresh here and start with a clean slate could you give the below troubleshooting steps a try?

  • Make sure any sites that you have on Local are exported and save them to a folder somewhere on your computer.

  • Fully uninstall Local from your computer.

  • Install the latest version of Local on this link.

  • Once installed, please restart the computer.

  • When the computer is restarted and turned on, close any applications that automatically run in the background (AntiVirus, Firewall, and other Developer applications included).

  • Check and see if the issue still persists. If so, please provide us with an updated log. Retrieving Local’s Log File

Keep us posted and we’d be happy to help further!

It’s not installation related. I have the same issue on all PC’s we’re working on.

I’m still wondering what you mean with password. I never set a Local password.

The password screen that Sam shared is not a Local password, it’s the user password for your machine. So whatever user/admin you use to actually log in and manage the system. Local needs that access for permissions to edit the hosts file.

If the other PCs you’re using are all Windows and you’ve checked the hosts files and privileges, you could also check to see if there are any other applications that could be interfering. Running other developer applications simultaneously could also cause similar issues. Apps like MAMP, XAMPP, or Docker for example.

Once the site is deleted, and the hosts file updated, the domain should become available unless something is interrupting that process. After deletion, you could try a quick quit and restart of Local as well to see if that helps refresh.

Yes, that’s why I asked if this was the iOS password. There is no such thing on Windows…

There are no other applications interfering. The hosts file is ‘clean’, and still the domain cannot be used.

We tested this on multiple PC’s and it’s not working anywhere.

I understand you’re on Windows, I was just answering your question about whether or not the password was from Local.

Could you provide some details about your testing? Are all of the machines you’re testing with on Windows?

On each machine I assume you’re creating a site/domain, and then deleting the site, checking the hosts file/perms, restarting Local?

Could you provide us some local logs for whatever machine you’re mainly using that is having the issue? There are some different ways to access and share Local Logs. For us to be able to troubleshoot thoroughly, please click the Download Local Logs button from the Support tab in Local. This will generate a zip archive that contains the Local log along with some other diagnostic information to help quickly zero in on any issues that Local is encountering.

Yes, I checked everything, hosts file included, if any other application was running, restarting Local and/or the machine, etc.

I just made a new attempt. This is an error from the local-lightning-verbose log:

{"level":"info","message":"checkLocalExport","thread":"worker","timestamp":"2024-02-16T15:36:26.973Z","worker":"analyzeImportWorker"}
{"level":"info","message":"Analyzing Zip: Listing Contents for Local Export Check","thread":"worker","timestamp":"2024-02-16T15:36:26.974Z","worker":"analyzeImportWorker"}
{"level":"debug","message":"Analysis of zip: Local Export","thread":"worker","timestamp":"2024-02-16T15:36:26.974Z","worker":"analyzeImportWorker"}
{"level":"info","message":"checkWpMigrate","thread":"worker","timestamp":"2024-02-16T15:36:26.974Z","worker":"analyzeImportWorker"}
{"level":"info","message":"Analyzing Zip: Listing Contents for WP Migrate Export Check","thread":"worker","timestamp":"2024-02-16T15:36:26.975Z","worker":"analyzeImportWorker"}
{"level":"info","message":"checkBackupBuddy","thread":"worker","timestamp":"2024-02-16T15:36:26.975Z","worker":"analyzeImportWorker"}
{"level":"info","message":"checkGenericArchive","thread":"worker","timestamp":"2024-02-16T15:36:26.975Z","worker":"analyzeImportWorker"}
{"level":"info","message":"Analyzing Archive: Listing Contents for Generic Archive Check","thread":"worker","timestamp":"2024-02-16T15:36:26.975Z","worker":"analyzeImportWorker"}
{"component":"ImportSiteAnalyzePage","level":"info","message":"Message from import-site-analyze-worker:","thread":"renderer","timestamp":"2024-02-16T15:36:27.052Z"}

Could you collect that zip with all of the logs included as mentioned above? If you’d prefer not to share public info here I can DM you to collect that!

I’m a bit prudent on doing that.
There are no more errors around that timestamp in the other log files though. So I doubt they are helpful.

Hi @henkvz,

I grabbed Windows screenshots of the prompts in case they are helpful. I am using the latest release of Local, v8.2.1.

When creating or deleting a site in Site Domains mode, this host redirection notice appears from Windows. This permits Local to edit the hosts file mentioned in the thread above:

macOS requires the user password, Windows requires administrative privileges and accepting the system prompt:

If I do not allow this, Local will not clean up the files necessary to remove that domain and make it available for reuse. After accepting, Local completes the deletion and I am able to remake a new site using the same domain, takendomain:

If you or your colleagues are not seeing those system prompts, it is likely due to a lack of administrative permissions on your machine. I am not familiar with how your systems are configured.

If you’re not seeing the taken domain in your etc/hosts directory, the other place you could check would be your sites.json, located at: AppData\Roaming\Local\sites.json. Similar to Sam’s guidance before, I would take a backup and be careful before making manual edits to this file.

Without your logs, we don’t have much else to go on. Hopefully this helps, best of luck!

1 Like

I have never seen that first screenshot, but the second one always comes up yes (also on generating a new site, etc.) which is logical.

There are no traces of the domain in both the hosts or the sites.json file. Strange.

Wait, I found it: Local did NOT remove the directories of the deleted sites! Despite having checked the ‘skip recycle bin’…

This is odd.

I removed the sites folders manually and now I can create them again.

This feels like a bug. I’m pretty sure I ‘skipped recycle bin’ on all those sites (from the last few months). But they are all there.

That sounds like expected behavior.

Local stores sites in your Local Sites\ directory. Each site has it’s own folder, such as Local Sites\takendomain.

When you delete a site, Local asks if the user would like to “move site files to trash”. If a user unchecks this box, the site files are left in the Local Sites directory. The alternative is the site folder is deleted and the site moved to the trash. It sounds like you might expect the opposite to happen?

Local will not allow you to create a site with the same name (and thus file path) as this would cause conflicts and files to be overwritten.

1 Like

@austinwendt I’ve also found the “Move site files to recycling bin” checkbox label confusing on site deletion. It can be read as, “if I don’t check it, Local will delete the files without placing them in the recycling bin” or “Local will not delete the files at all”. It might be worth revising the messaging there a little to clarify.

1 Like

That is exactly what I thought it did: skipping recycle bin will permanently/directly delete the files and folder.
Usually a recycle bin means you can recover files within like 30 days, structures remain intact, etc.
I thought unchecking made it all remove permanently.

1 Like

That’s fair, I can see how that would be confusing!

I’ll chat with our product designer and create a ticket for the engineering team to add something that will make that action more clear. Thanks @henkvz and @burt for helping us improve the product. :heart:

I’m glad you were able to get it working though - let us know if we can help with anything else!

3 Likes