A name collision occurs when an attempt to resolve a name used in a private namespace, such as Top-Level Domain or unqualified name results in a query to the public Domain Name System (DNS). When the administrative boundaries of private and public namespaces overlap, name resolution may yield unintended or harmful results.
What Causes the ERR_ICAN_NAME_COLLISION?
This can be caused because of the hostname mostly, but there can be other reasons which can arise in this issue, some of those are listed below.
- Incorrect Syntax or Names: Some basic problems can be like the name of hosts file should be hosts and not host without any extensions with it. A single incorrect syntax can mess up your entire program.
- White spaces: If the code is copied from somewhere, then there is a possibility that your code will end up with multiple spaces.
- Permissions and Proxies: Sometimes there can be issues with the permission on the file or file attributes. If there is a proxy configured on the system, then It may bypass the hosts file. Using no proxy is a better option to get less issue.
Now that you have a basic understanding of the nature of the problem, we will move on towards the methods.
Method 1: Making Sure Your hosts File is Correct
Before you check problem elsewhere, make sure that the hosts file is working correctly. The basic correction about the hosts file will be:
- The file name should be “hosts” and not host
You can locate hosts file here:
- There should be no extension for the hosts file
Note: Make sure you check the extension, because windows have an option of hiding extensions in view tab
You can find the view tab in file explorer’s menu bar
- The syntax should be correct in the hosts file
- Make sure you take care of all variants (www.example.com and example.com), sometimes one works but others won’t. Just add both to be safe.
You can check if the host file is working or not by typing the following commands in CMD (Admin Mode)
- Go to where CMD is, start menu or search in the search bar
Note: For older windows, it will be: Start > All Programs > Accessories
- Right-click on CMD, select “Run as Administrator”
- Type this command in cmd and enter:
This will drop the old data records that may have been used.
- Now type the entry address that you added in your hosts file, to check if it uses the correct IP
ping example.com –n 1 ping -6 ipv6.example.com –n 1
- If the IP is correct, it means your hosts file is working fine and the problem is elsewhere
- But if the IP test fails, then you can reset the NetBios cache with typing this command in cmd (admin mode):
- And you can check the current data in the DNS cache with the following command in cmd (normal mode):
ipconfig /displaydns | more
Method 2: Checking for Whitespace
A single space even at the blank entry between two lines can mess things up. Notepad++ can help in showing the characters and inspecting the number of whitespace characters. If you copied the host entries from somewhere else, then there is the possibility of multiple spaces in it. To make sure the spaces don’t mess things up, just use spaces or tabs, not both and terminate the file with a blank line.
Method 3: Checking and Editing the Registry
You can find the key in registry editor which is specifying the location of the hosts file. You can check the entry in the key. If it wasn’t the correct one, then you can edit it. Also, for those who are missing the key in their registry or several other entries; they can create it or just copy it from other machines, that already have these.
- Open “Run” by pressing Windows + R keys
- Type regedit in it and enter
- Now go to the following directory in Registry Editor:
- DataBasePath is the key that you will be checking, the entry in it should be:
Method 4: Creating New hosts File with Default Permissions
The permission for the already available hosts file can have some issues. You can create the new one and copy the content of the existing one to the new one. The old hosts file will have the grey check marks, while the new will have black check marks. What this will do is, that the system will recreate the file with default permissions. To do so, follow the steps below:
- Create a new text file on Desktop
- Now open your “Notepad” as an administrator
- Click File and then Open
- Then, go to the following address:
- Locate the “hosts” file and open it, select all the text and copy it
- And paste it into the text file that you created on the Desktop
- Rename it to “hosts” without any extensions
- Now this is a bit tricky step, you need to copy (do not move) the new hosts file to the existing one and overwrite it
Note: For some users, copying worked and for some moving worked. First, try copying one.
If you are unable to read the existing old hosts file. You can do the following steps:
- Go to the following directory:
- Right-click “hosts” file and select “Properties”
- Now go into the “Security” tab
- In “Group or usernames” box, find the
- Check the permissions in below box and see if the user is allowed or not
- If the user is not allowed you can click “Edit” and there tick the following box for a user to allow:
Read & Execute
- Then you will be able to edit the hosts file in notepad by opening it as administrator.
Method 5: Checking Proxy Issues
This method is about; if any proxy is configured on the system which might be bypassing the hosts file. In this method, we will check, if the system is running any proxy. We can check it on Internet Explorer by following steps:
- Hold the Windows Key and Press R. Type inetcpl.cpl and Click OK.
- Select the Connections tab and click on LAN settings
- Make sure the “Automatically detect settings” is checked, and the Proxy server is unticked. After checking the proxy settings, check if the issue is resolved.