microsoft/qlib · error · ValueError

Invalid mount path: {mount_path}!

Error message

Invalid mount path: {mount_path}!

What it means

Raised by Yahoo Run.download_data when interval is "1d" and the requested end date is in the future relative to today's local date. Yahoo Finance cannot return daily bars for dates that have not happened yet, so the collector refuses the request up front rather than downloading truncated/confusing data. Note the guard applies only to 1d; 1min downloads have their own bounds handling elsewhere.

Source

Thrown at qlib/__init__.py:90

                    logger.warning(f"auto_path is False, please make sure {mount_path} is mounted")
        elif uri_type == C.NFS_URI:
            _mount_nfs_uri(provider_uri, C.dpm.get_data_uri(_freq), C["auto_mount"])
        else:
            raise NotImplementedError(f"This type of URI is not supported")

    C.register()

    if "flask_server" in C:
        logger.info(f"flask_server={C['flask_server']}, flask_port={C['flask_port']}")
    logger.info("qlib successfully initialized based on %s settings." % default_conf)
    data_path = {_freq: C.dpm.get_data_uri(_freq) for _freq in C.dpm.provider_uri.keys()}
    logger.info(f"data_path={data_path}")


def _mount_nfs_uri(provider_uri, mount_path, auto_mount: bool = False):
    LOG = get_module_logger("mount nfs", level=logging.INFO)
    if mount_path is None:
        raise ValueError(f"Invalid mount path: {mount_path}!")
    if not re.match(r"^[a-zA-Z0-9.:/\-_]+$", provider_uri):
        raise ValueError(f"Invalid provider_uri format: {provider_uri}")
    # FIXME: the C["provider_uri"] is modified in this function
    # If it is not modified, we can pass only  provider_uri or mount_path instead of C
    mount_command = ["sudo", "mount.nfs", provider_uri, mount_path]
    # If the provider uri looks like this 172.23.233.89//data/csdesign'
    # It will be a nfs path. The client provider will be used
    if not auto_mount:  # pylint: disable=R1702
        if not Path(mount_path).exists():
            raise FileNotFoundError(
                f"Invalid mount path: {mount_path}! Please mount manually: {' '.join(mount_command)} or Set init parameter `auto_mount=True`"
            )
    else:
        # Judging system type
        sys_type = platform.system()
        if "windows" in sys_type.lower():
            # system: window
            try:

View on GitHub (pinned to 79633dd950)

Solutions

  1. Pass an end date that is today or earlier: --end $(date +%F).
  2. Omit or adjust the computation producing the future date (check for off-by-one in date arithmetic, e.g. end = today + timedelta(days=1)).
  3. If you genuinely want 'up to now', use today's date explicitly rather than a sentinel future date.

Example fix

# before
python collector.py download_data --source_dir ~/.qlib/stock_data/source --region CN --start 2020-11-01 --end 2030-01-01 --interval 1d

# after
python collector.py download_data --source_dir ~/.qlib/stock_data/source --region CN --start 2020-11-01 --end $(date +%F) --interval 1d
Defensive patterns

Strategy: validation

Validate before calling

import datetime
end = min(pd.Timestamp(end), pd.Timestamp(datetime.date.today()))  # clamp before calling download_data

Try / catch

try:
    run.download_data(..., end=end)
except ValueError as e:
    if "greater than the current date" in str(e):
        end = datetime.date.today().isoformat()
        run.download_data(..., end=end)
    else:
        raise

Prevention

When it happens

Trigger: Calling `python collector.py download_data --interval 1d --end 2030-01-01` (any end > today), or calling Run(source_dir=..., interval="1d", ...).download_data(..., end=<future date>) programmatically. Timezone skew matters too: pd.Timestamp(end) is compared to datetime.now() local date, so running near midnight with date formats that resolve to the next day can trip it.

Common situations: Copy-pasted commands from tutorials with stale/hardcoded future end dates (e.g. examples written when '2025-12-31' was in the future); cron scripts that compute end as today+N by mistake; users assuming end is exclusive or that a future end is clamped silently.

Related errors


AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15). Data as JSON: /api/errors/3df4618cc3b4d942. Report an issue: GitHub.