{"record":{"id":"b2aac15bc427293f","repo":"apache/beam","slug":"collection-name-must-be-provided-milvus-search","errorCode":null,"errorMessage":"Collection name must be provided","messagePattern":"Collection name must be provided","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/ml/rag/ingestion/milvus_search.py","lineNumber":70,"sourceCode":"      Must be a non-empty string.\n    partition_name: Name of the specific partition within the collection to\n      write to. If empty, writes to the default partition.\n    timeout: Maximum time in seconds to wait for write operations to complete.\n      If None, uses the client's default timeout.\n    write_config: Configuration for write operations including batch size and\n      other write-specific settings.\n    kwargs: Additional keyword arguments for write operations. Enables forward\n      compatibility with future Milvus client parameters.\n  \"\"\"\n  collection_name: str\n  partition_name: str = \"\"\n  timeout: Optional[float] = None\n  write_config: WriteConfig = field(default_factory=WriteConfig)\n  kwargs: dict[str, Any] = field(default_factory=dict)\n\n  def __post_init__(self):\n    if not self.collection_name:\n      raise ValueError(\"Collection name must be provided\")\n\n  @property\n  def write_batch_size(self):\n    \"\"\"Returns the batch size for write operations.\n\n    Returns:\n      The configured batch size, or DEFAULT_WRITE_BATCH_SIZE if not specified.\n    \"\"\"\n    return self.write_config.write_batch_size or DEFAULT_WRITE_BATCH_SIZE\n\n\n@dataclass\nclass MilvusVectorWriterConfig(VectorDatabaseWriteConfig):\n  \"\"\"Configuration for writing vector data to Milvus collections.\n\n  This class extends VectorDatabaseWriteConfig to provide Milvus-specific\n  configuration for ingesting vector embeddings and associated metadata.\n  It defines how EmbeddableItem objects are converted to Milvus records and","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/ml/rag/ingestion/milvus_search.py#L52-L88","documentation":"MilvusSearchWriteOptions.__post_init__ validates that collection_name was set on the dataclass. The Milvus vector sink needs a target collection to write embeddings to; without it no write destination exists, so construction fails immediately.","triggerScenarios":"Constructing MilvusSearchWriteOptions() (or passing MilvusSearchWriteOptions(connection_config=..., ...)) while omitting collection_name, or explicitly passing collection_name=None/empty string.","commonSituations":"Copy-pasting a write-options snippet and forgetting to fill in the collection name; building options dynamically from config where the collection key is missing; renaming a collection and leaving the variable empty.","solutions":["Pass collection_name='<your Milvus collection>' to MilvusSearchWriteOptions.","Load the collection name from config/environment and assert it is non-empty before constructing the options.","Verify you are not using a keyword like collection; the dataclass field is collection_name."],"exampleFix":"// before\nwrite_options = MilvusSearchWriteOptions(connection_config=cfg)\n// after\nwrite_options = MilvusSearchWriteOptions(\n    connection_config=cfg,\n    collection_name=\"my_rag_collection\")","handlingStrategy":"validation","validationCode":"assert options.collection_name, \"collection_name must be set before writing to Milvus\"","typeGuard":"def has_collection(o) -> bool:\n    return bool(getattr(o, \"collection_name\", None))","tryCatchPattern":"try:\n    options = MilvusSearchWriteOptions(**opts)\nexcept ValueError as e:\n    if \"Collection name must be provided\" in str(e):\n        opts[\"collection_name\"] = default_collection\n        options = MilvusSearchWriteOptions(**opts)\n    else:\n        raise","preventionTips":["Always set collection_name explicitly when building MilvusSearchWriteOptions","Validate pipeline config for required Milvus keys before launching the Beam pipeline","Add a unit test asserting the options dataclass builds with your defaults"],"tags":["python","milvus","rag","config-validation"],"backgroundTag":"missing-required-config-field","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}