{"record":{"id":"6c8cfb43c57981eb","repo":"microsoft/qlib","slug":"no-file-starting-with-filename-without-suffix","errorCode":null,"errorMessage":"No file starting with '{filename_without_suffix}' found","messagePattern":"No file starting with '(.+?)' found","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"qlib/rl/data/pickle_styled.py","lineNumber":78,"sourceCode":"            \"$askV3\",\n            \"$askV5\",\n        ]\n    if shape == 6:\n        return [\"$high\", \"$low\", \"$open\", \"$close\", \"$vwap\", \"$volume\"]\n    elif shape == 5:\n        return [\"$high\", \"$low\", \"$open\", \"$close\", \"$volume\"]\n    raise ValueError(f\"Unrecognized data shape: {shape}\")\n\n\ndef _find_pickle(filename_without_suffix: Path) -> Path:\n    suffix_list = [\".pkl\", \".pkl.backtest\"]\n    paths: List[Path] = []\n    for suffix in suffix_list:\n        path = filename_without_suffix.parent / (filename_without_suffix.name + suffix)\n        if path.exists():\n            paths.append(path)\n    if not paths:\n        raise FileNotFoundError(f\"No file starting with '{filename_without_suffix}' found\")\n    if len(paths) > 1:\n        raise ValueError(f\"Multiple paths are found with prefix '{filename_without_suffix}': {paths}\")\n    return paths[0]\n\n\n@lru_cache(maxsize=10)  # 10 * 40M = 400MB\ndef _read_pickle(filename_without_suffix: Path) -> pd.DataFrame:\n    df = pd.read_pickle(_find_pickle(filename_without_suffix))\n    index_cols = df.index.names\n\n    df = df.reset_index()\n    for date_col_name in [\"date\", \"datetime\"]:\n        if date_col_name in df:\n            df[date_col_name] = pd.to_datetime(df[date_col_name])\n    df = df.set_index(index_cols)\n\n    return df\n","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/rl/data/pickle_styled.py#L60-L96","documentation":"_find_pickle (qlib/rl/data/pickle_styled.py:78) resolves a pickle file for a given base name (without suffix) by probing '<name>.pkl' and '<name>.pkl.backtest'. If neither exists on disk it raises FileNotFoundError(\"No file starting with '<name>' found\"). This typically surfaces via _read_pickle when qlib.rl loads process/order data for an exchange or date whose dump is absent.","triggerScenarios":"Constructing pickle-styled data objects with a base path that has no .pkl or .pkl.backtest sibling; typo'd instrument/date directory names; referencing data dumps that were never downloaded or generated.","commonSituations":"Running RL backtests on data not yet dumped via the provided scripts; missing exchange-day pickles (holidays, delisted stocks); wrong data root path in config; case-sensitive filesystem mismatches.","solutions":["Check that <base>.pkl or <base>.pkl.backtest actually exists before constructing the data object","Generate the missing dump with qlib's data dump/preprocessing scripts for RL","Verify the data root directory and instrument/date path components in your config","On case-sensitive filesystems, verify exact filename casing"],"exampleFix":"# before\ndata = pickle_styled.load(base_path)  # FileNotFoundError\n\n# after\nassert (base_path.with_suffix('.pkl')).exists() or base_path.with_name(base_path.name + '.pkl.backtest').exists(), f'dump missing: {base_path}'\ndata = pickle_styled.load(base_path)","handlingStrategy":"validation","validationCode":"from pathlib import Path\ncandidates = [base.with_name(base.name + s) for s in ('.pkl', '.pkl.backtest')]\nassert any(p.is_file() for p in candidates), f'no pickle for {base}'","typeGuard":null,"tryCatchPattern":"try:\n    df = _read_pickle(base)\nexcept FileNotFoundError as e:\n    raise FileNotFoundError(f'run the RL data dump scripts first for {base}') from e","preventionTips":["Pre-check candidate paths before loading in batch loops over instruments/dates","Keep a manifest of generated dumps and verify it at startup"],"tags":["qlib","rl","pickle","file-not-found","data"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}