HelloZeroNet/ZeroNet · error · Exception

Unable to load %s: %s

Error message

Unable to load %s: %s

What it means

Wrap-up error in SiteManager.load: while reading data/sites.json and instantiating sites, any per-site failure (corrupt entry, missing data directory, Site constructor exception) is logged and re-raised in this 'Unable to load %s: %s' form. The input at fault is the malformed or broken sites.json entry for the named address.

Source

Thrown at src/Site/SiteManager.py:45

        gevent.spawn(self.saveTimer)
        atexit.register(lambda: self.save(recalculate_size=True))

    # Load all sites from data/sites.json
    @util.Noparallel()
    def load(self, cleanup=True, startup=False):
        from Debug import Debug
        self.log.info("Loading sites... (cleanup: %s, startup: %s)" % (cleanup, startup))
        self.loaded = False
        from .Site import Site
        address_found = []
        added = 0
        load_s = time.time()
        # Load new adresses
        try:
            json_path = "%s/sites.json" % config.data_dir
            data = json.load(open(json_path))
        except Exception as err:
            raise Exception("Unable to load %s: %s" % (json_path, err))

        sites_need = []

        for address, settings in data.items():
            if address not in self.sites:
                if os.path.isfile("%s/%s/content.json" % (config.data_dir, address)):
                    # Root content.json exists, try load site
                    s = time.time()
                    try:
                        site = Site(address, settings=settings)
                        site.content_manager.contents.get("content.json")
                    except Exception as err:
                        self.log.debug("Error loading site %s: %s" % (address, err))
                        continue
                    self.sites[address] = site
                    self.log.debug("Loaded site %s in %.3fs" % (address, time.time() - s))
                    added += 1
                elif startup:

View on GitHub (pinned to 454c0b2e7e)

Solutions

  1. Inspect data/sites.json and remove/fix the corrupt site entry named in the message
  2. Check the site's data directory for missing or damaged files and rebuild it
  3. Recover from the backup sites.json (sites.json.bak) if the file is corrupted
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/Site/SiteManager.py:45 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HelloZeroNet/ZeroNet@454c0b2e7e (2026-09-02). Data as JSON: /api/errors/764578eecc93d08b. Report an issue: GitHub.