HelloZeroNet/ZeroNet · error · Exception

Directory not exists: %s

Error message

Directory not exists: %s

What it means

Guard raised by SiteStorage.__init__ when the site's data directory (config.data_dir/<address>) does not exist on disk and creation is not allowed. The input at fault is the site address whose expected directory is missing, typically after deletion or a data-dir misconfiguration.

Source

Thrown at src/Site/SiteStorage.py:44


@PluginManager.acceptPlugins
class SiteStorage(object):
    def __init__(self, site, allow_create=True):
        self.site = site
        self.directory = "%s/%s" % (config.data_dir, self.site.address)  # Site data diretory
        self.allowed_dir = os.path.abspath(self.directory)  # Only serve file within this dir
        self.log = site.log
        self.db = None  # Db class
        self.db_checked = False  # Checked db tables since startup
        self.event_db_busy = None  # Gevent AsyncResult if db is working on rebuild
        self.has_db = self.isFile("dbschema.json")  # The site has schema

        if not os.path.isdir(self.directory):
            if allow_create:
                os.mkdir(self.directory)  # Create directory if not found
            else:
                raise Exception("Directory not exists: %s" % self.directory)

    def getDbFile(self):
        if self.db:
            return self.db.schema["db_file"]
        else:
            if self.isFile("dbschema.json"):
                schema = self.loadJson("dbschema.json")
                return schema["db_file"]
            else:
                return False

    # Create new databaseobject  with the site's schema
    def openDb(self, close_idle=False):
        schema = self.getDbSchema()
        db_path = self.getPath(schema["db_file"])
        return Db(schema, db_path, close_idle=close_idle)

    def closeDb(self, reason="Unknown (SiteStorage)"):

View on GitHub (pinned to 454c0b2e7e)

Solutions

  1. Create the site directory or re-download the site so data/<address> exists
  2. Pass allow_create=True when SiteStorage is constructed for a new site
  3. Verify config.data_dir points to the correct location before touching site storage
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/Site/SiteStorage.py:44 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/bc23a0cb419aaa66. Report an issue: GitHub.