{"record":{"id":"8dcfab2f8c2b9766","repo":"apache/beam","slug":"uri-must-be-provided-for-milvus-connection","errorCode":null,"errorMessage":"URI must be provided for Milvus connection","messagePattern":"URI must be provided for Milvus connection","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/ml/rag/utils.py","lineNumber":68,"sourceCode":"      and not using token authentication.\n    db_name: Database Name to connect to. Specifies which Milvus database to\n      use. Defaults to 'default'.\n    token: Authentication token as an alternative to username/password.\n    timeout: Connection timeout in seconds. Uses client default if None.\n    kwargs: Optional keyword arguments for additional connection parameters.\n      Enables forward compatibility.\n  \"\"\"\n  uri: str\n  user: str = field(default_factory=str)\n  password: str = field(default_factory=str)\n  db_name: str = \"default\"\n  token: str = field(default_factory=str)\n  timeout: Optional[float] = None\n  kwargs: dict[str, Any] = field(default_factory=dict)\n\n  def __post_init__(self):\n    if not self.uri:\n      raise ValueError(\"URI must be provided for Milvus connection\")\n\n    # Generate unique alias if not provided. One-to-one mapping between alias\n    # and connection - each alias represents exactly one Milvus connection.\n    if \"alias\" not in self.kwargs:\n      alias = f\"milvus_conn_{uuid.uuid4().hex[:8]}\"\n      self.kwargs[\"alias\"] = alias\n\n\nclass MilvusHelpers:\n  \"\"\"Utility class providing helper methods for Milvus vector db operations.\"\"\"\n  @staticmethod\n  def sparse_embedding(\n      sparse_vector: Optional[tuple[list[int], list[float]]]\n  ) -> Optional[dict[int, float]]:\n    if not sparse_vector:\n      return None\n    # Converts sparse embedding from (indices, values) tuple format to\n    # Milvus-compatible values dict format {dimension_index: value, ...}.","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/ml/rag/utils.py#L50-L86","documentation":"MilvusConnectionParameters.__post_init__ requires a non-empty uri (e.g. 'https://localhost:19530' or 'milvus-demo.db.zillizcloud.com:19530'); without a URI there is no endpoint to attach the Milvus client to.","triggerScenarios":"Constructing MilvusConnectionParameters() with uri=None or empty string '' — e.g. omitting the uri kwarg or passing Milvus uri via a variable that is unset/empty.","commonSituations":"Missing MILVUS_URI environment variable; building connection params from a config dict where the uri key is absent; local Milvus setups forgetting the 'http://localhost:19530' endpoint.","solutions":["Pass a uri, e.g. MilvusConnectionParameters(uri='http://localhost:19530')","For Zilliz Cloud / Milvus Lite use the appropriate https URI or local file path","Verify the env var/config feeding uri is set and non-empty before constructing","Ensure uri is a string, not None passed explicitly"],"exampleFix":"// before\nparams = MilvusConnectionParameters(token=token)\n// after\nparams = MilvusConnectionParameters(uri=\"http://localhost:19530\", token=token)","handlingStrategy":"validation","validationCode":"uri = os.environ.get(\"MILVUS_URI\")\nif not uri:\n    raise ValueError(\"MILVUS_URI must be set before creating Milvus connection params\")","typeGuard":"def has_uri(params) -> bool:\n    return isinstance(params.uri, str) and params.uri != \"\"","tryCatchPattern":null,"preventionTips":["Set MILVUS_URI in the environment or pipeline options before launch","Default to 'http://localhost:19530' for local dev instead of leaving uri unset","Validate config dicts for the uri key before constructing parameters"],"tags":["python","milvus","configuration","vector-database"],"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"}