{"record":{"id":"aa7c83d4392ba323","repo":"xai-org/x-algorithm","slug":"either-metadata-path-or-index-path-must-be-provide","errorCode":null,"errorMessage":"Either metadata_path or index_path must be provided","messagePattern":"Either metadata_path or index_path must be provided","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phoenix/xrex/data/parquet_recsys.py","lineNumber":269,"sourceCode":"        batch_size: int,\n        num_shards: int,\n        shard_index: int,\n        interleave_k: int,\n        num_kafka_partitions: int,\n        skip_rows: int = 0,\n        date_range: tuple[str, str] | None = None,\n        continuous: bool = False,\n        poll_interval_s: float = 60.0,\n        resume_position: DataPosition | None = None,\n        min_timestamp_ms: int | None = None,\n        max_timestamp_ms: int | None = None,\n        conversion_delay_columns: list[str] | None = None,\n        include_action_delay_columns: bool = False,\n    ):\n        self._conversion_delay_columns = conversion_delay_columns\n        self._include_action_delay_columns = include_action_delay_columns\n        if metadata_path is None and index_path is None:\n            raise ValueError(\"Either metadata_path or index_path must be provided\")\n\n        if resume_position is not None and metadata_path is None:\n            raise ValueError(\n                \"resume_position is only supported in metadata mode (.valid_batches.json)\"\n            )\n\n        has_time_range = min_timestamp_ms is not None or max_timestamp_ms is not None\n        if has_time_range and metadata_path is None:\n            raise ValueError(\n                \"min_timestamp_ms/max_timestamp_ms require metadata mode (.valid_batches.json)\"\n            )\n\n        self._index_path = index_path\n        self._metadata_path = metadata_path\n        if metadata_path is not None:\n            if topic_dir is None:\n                topic_dir = str(Path(metadata_path).parent)\n            topic_dir = os.path.abspath(topic_dir)","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/phoenix/xrex/data/parquet_recsys.py#L251-L287","documentation":"The ParquetRecsys dataset constructor requires exactly one of metadata_path (.valid_batches.json mode) or index_path (plain file-list mode) to locate batch files. If both are None the dataset has nothing to enumerate and raises ValueError immediately.","triggerScenarios":"Constructing the dataset with neither argument; passing None because a config template left both keys unset; passing an option like file_list that the constructor does not support.","commonSituations":"Incomplete config after copying a template; programmatic construction where the path variable is None due to an upstream if-branch.","solutions":["Pass metadata_path pointing to .valid_batches.json (enables resume/time-range features), or index_path pointing to a text file listing parquet paths.","Generate the index file (one absolute path per line) if you only have a directory of parquet files.","Verify the config key actually reaches the constructor (no typo/None default)."],"exampleFix":"# before\nds = ParquetRecsysDataset(topic_dir='/data/topic')  # ValueError\n\n# after\nopen('files.txt','w').write('\\n'.join(glob('/data/topic/**/*.parquet', recursive=True)))\nds = ParquetRecsysDataset(topic_dir='/data/topic', index_path='files.txt')","handlingStrategy":"validation","validationCode":"if metadata_path is None and index_path is None:\n    index_path = generate_index_from_dir(topic_dir)  # write files.txt\nassert metadata_path or index_path","typeGuard":null,"tryCatchPattern":"try:\n    ds = ParquetRecsysDataset(...)\nexcept ValueError as e:\n    raise ConfigError(str(e)) from e","preventionTips":["Validate dataset config keys before job submission.","Auto-generate an index file from the topic dir when metadata is absent."],"tags":["configuration","required-argument","dataset"],"backgroundTag":"missing-configuration","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}