{"record":{"id":"d2e2d563ea3eaccf","repo":"fishaudio/fish-speech","slug":"i-is-not-a-file-or-directory","errorCode":null,"errorMessage":"{i} is not a file or directory","messagePattern":"(.+?) is not a file or directory","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"fish_speech/datasets/semantic.py","lineNumber":133,"sourceCode":"        while True:\n            yield self.augment()\n\n    def init_mock_data_server(self):\n        if self.groups is not None:\n            return\n\n        # Expand the proto files\n        expanded_proto_files = []\n        for filename in self.proto_files:\n            for i in braceexpand(filename):\n                i = Path(i)\n                if i.is_file():\n                    expanded_proto_files.append(i)\n                elif i.is_dir():\n                    expanded_proto_files.extend(i.rglob(\"*.proto\"))\n                    expanded_proto_files.extend(i.rglob(\"*.protos\"))\n                else:\n                    raise ValueError(f\"{i} is not a file or directory\")\n\n        expanded_proto_files = sorted(expanded_proto_files)\n        Random(self.seed).shuffle(expanded_proto_files)\n\n        self.groups = []\n        shard_proto_files = split_by_rank_worker(expanded_proto_files)\n        log.info(\n            f\"Reading {len(shard_proto_files)} / {len(expanded_proto_files)} files\"\n        )\n\n        count = 0\n        for filename in shard_proto_files:\n            with open(filename, \"rb\") as f:\n                for text_data in read_pb_stream(f):\n                    self.groups.append(text_data)\n                    count += 1\n\n        log.info(f\"Read total {count} groups of data\")","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/fishaudio/fish-speech/blob/befe4001745417f8c42131739d862b8a6fdbd15a/fish_speech/datasets/semantic.py#L115-L151","documentation":"SemanticDataset.init_mock_data_server expands each entry of proto_files (or the equivalent list) into .proto/.protos files: files are kept, directories are recursively globbed. If an entry is neither an existing file nor an existing directory (typo, missing mount, or empty/None path coerced to a nonexistent path), a ValueError is raised.","triggerScenarios":"Calling init_mock_data_server (or sample_data which calls it) with a path string that doesn't exist on disk, e.g. \"data/train.protos\" when the file was never downloaded or the container path differs.","commonSituations":"Wrong data_root/protos path in training config YAML, datasets not downloaded/mounted in Docker, running from a different working directory so relative paths don't resolve.","solutions":["Verify the path exists: `ls <path>` from the same working directory you launch training","Use absolute paths in the dataset config","Re-download or mount the dataset; create parent dirs if generating .protos files yourself"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from pathlib import Path\npaths = [Path(p) for p in proto_files]\nmissing = [p for p in paths if not p.exists()]\nassert not missing, f\"missing proto paths: {missing}\"","typeGuard":null,"tryCatchPattern":"try:\n    dataset.init_mock_data_server()\nexcept ValueError as e:\n    if \"is not a file or directory\" in str(e):\n        # fix paths and retry\n        ...\n    raise","preventionTips":["Resolve dataset paths to absolute paths at config load time","Fail fast on missing dataset paths at app startup rather than mid-training"],"tags":["file-not-found","dataset","path-validation","python"],"backgroundTag":"path-not-found","analyzedSha":"befe4001745417f8c42131739d862b8a6fdbd15a","analyzedAt":"2026-08-27T21:31:45.703Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}