HelloZeroNet/ZeroNet · error
Random error: site exist!
Error message
Random error: site exist!
What it means
getNewSiteData derives a new site private key from the master seed at a random bip32_index, converts it to an address, and asserts that address is unused. If the derived address already exists in self.sites (an astronomically unlikely collision, or a non-random index being reused), it raises 'Random error: site exist!' to prevent overwriting existing site data.
Source
Thrown at src/User/User.py:101
del(self.sites[address])
self.saveDelayed()
self.log.debug("Deleted site: %s" % address)
def setSiteSettings(self, address, settings):
site_data = self.getSiteData(address)
site_data["settings"] = settings
self.saveDelayed()
return site_data
# Get data for a new, unique site
# Return: [site_address, bip32_index, {"auth_address": "xxx", "auth_privatekey": "xxx", "privatekey": "xxx"}]
def getNewSiteData(self):
import random
bip32_index = random.randrange(2 ** 256) % 100000000
site_privatekey = CryptBitcoin.hdPrivatekey(self.master_seed, bip32_index)
site_address = CryptBitcoin.privatekeyToAddress(site_privatekey)
if site_address in self.sites:
raise Exception("Random error: site exist!")
# Save to sites
self.getSiteData(site_address)
self.sites[site_address]["privatekey"] = site_privatekey
self.save()
return site_address, bip32_index, self.sites[site_address]
# Get BIP32 address from site address
# Return: BIP32 auth address
def getAuthAddress(self, address, create=True):
cert = self.getCert(address)
if cert:
return cert["auth_address"]
else:
return self.getSiteData(address, create)["auth_address"]
def getAuthPrivatekey(self, address, create=True):
cert = self.getCert(address)
if cert:View on GitHub (pinned to 454c0b2e7e)
Solutions
- Simply retry — the index is random each call, so a second attempt will almost certainly succeed
- Check users/sites.json for duplicate or stale entries of the conflicting address and remove/merge them
- Patch the code to loop with a new random bip32_index instead of raising (wrap the collision check in a while loop)
- Verify the master_seed is correct; a truncated/duplicated seed can reproduce identical addresses
Example fix
// before
if site_address in self.sites:
raise Exception("Random error: site exist!")
// after
while True:
bip32_index = random.randrange(2 ** 256) % 100000000
site_privatekey = CryptBitcoin.hdPrivatekey(self.master_seed, bip32_index)
site_address = CryptBitcoin.privatekeyToAddress(site_privatekey)
if site_address not in self.sites:
break Defensive patterns
Strategy: retry
Validate before calling
if site_address in user.sites:
# pick a different index before calling getNewSiteData
bip32_index = (bip32_index + 1) % 100000000 Try / catch
for attempt in range(3):
try:
address, index, site_data = user.getNewSiteData()
break
except Exception as e:
if 'Random error: site exist' in str(e):
continue
raise Prevention
- Retry on this error — collisions are astronomically unlikely
- Keep users/sites.json intact and avoid duplicate site entries
- Do not reuse or truncate master seeds
- If creating many sites, monitor for repeated collisions as a sign of corrupted state
When it happens
Trigger: Calling getNewSiteData (used when creating a new site or cloning) when the randomly chosen bip32_index maps to an address already registered in the user's sites — effectively a 1-in-100-million collision per attempt, or deterministic seeds/indexes being reused.
Common situations: Corrupted or duplicated sites.json causing repeated creation attempts to collide; users with extremely large numbers of sites; code paths that reuse the same master_seed and a previously used index.
Related errors
- Invalid response: %s
- Announce onion address to failed: %s
- Includes not allowed
- Invalid json file: %s
- We have newer (Our: %s, Sent: %s)
AI-assisted analysis of HelloZeroNet/ZeroNet@454c0b2e7e (2026-09-02).
Data as JSON: /api/errors/1a4fba31f5ce95fc.
Report an issue: GitHub.