{"record":{"id":"d8ce1375cd91d71c","repo":"apache/beam","slug":"unknown-conflict-resolution-conflict-resolution-action","errorCode":null,"errorMessage":"Unknown conflict resolution {conflict_resolution.action}","messagePattern":"Unknown conflict resolution (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/ml/rag/ingestion/mysql.py","lineNumber":88,"sourceCode":"  def __init__(self, primary_key_field: str):\n    self.primary_key_field = primary_key_field\n\n  def get_conflict_clause(self, all_columns: list[str]) -> str:\n    return f\"ON DUPLICATE KEY UPDATE {self.primary_key_field}\"\\\n       f\" = {self.primary_key_field}\"\n\n\ndef _create_conflict_strategy(\n    conflict_resolution: Optional[ConflictResolution]\n) -> _ConflictResolutionStrategy:\n  if conflict_resolution is None:\n    return _NoConflictStrategy()\n  if conflict_resolution.action == \"UPDATE\":\n    return _UpdateStrategy(conflict_resolution.update_fields)\n  if conflict_resolution.action == \"IGNORE\":\n    assert conflict_resolution.primary_key_field is not None\n    return _IgnoreStrategy(conflict_resolution.primary_key_field)\n  raise ValueError(f\"Unknown conflict resolution {conflict_resolution.action}\")\n\n\nclass _MySQLQueryBuilder:\n  def __init__(\n      self,\n      table_name: str,\n      *,\n      column_specs: list[ColumnSpec],\n      conflict_resolution: Optional[ConflictResolution] = None):\n    \"\"\"Builds SQL queries for writing EmbeddableItems with Embeddings to MySQL.\n    \"\"\"\n    self.table_name = table_name\n\n    self.column_specs = column_specs\n    self.conflict_resolution_strategy = _create_conflict_strategy(\n        conflict_resolution)\n\n    names = [col.column_name for col in self.column_specs]","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/ml/rag/ingestion/mysql.py#L70-L106","documentation":"_create_conflict_strategy maps ConflictResolution.action to an ON CONFLICT strategy for the MySQL RAG sink. Only 'UPDATE', 'IGNORE', and None (no conflict handling) are supported; any other action string is rejected at writer construction.","triggerScenarios":"Calling the MySQL RAG writer __init__ with ConflictResolution(action='SOMETHING_ELSE') — a typo like 'update' (lowercase), 'REPLACE', or 'UPSERT'.","commonSituations":"Case-sensitivity typos in config files; assuming SQL keywords like REPLACE/UPSERT are valid actions; migrating configs from another database sink that supports more actions.","solutions":["Set action to one of None, 'UPDATE', or 'IGNORE' (exact uppercase strings).","If you intended IGNORE, also set primary_key_field, otherwise a later error fires.","If you intended 'update', fix the casing — string comparison is case-sensitive."],"exampleFix":"// before\nConflictResolution(action=\"UPSERT\", update_fields=[\"embedding\"])\n// after\nConflictResolution(action=\"UPDATE\", update_fields=[\"embedding\"])","handlingStrategy":"validation","validationCode":"assert conflict_resolution.action in (None, 'UPDATE', 'IGNORE'), f\"unsupported action {conflict_resolution.action!r}\"","typeGuard":"def is_valid_action(cr) -> bool:\n    return cr is None or cr.action in (None, \"UPDATE\", \"IGNORE\")","tryCatchPattern":"try:\n    writer = MySqlVectorWriterConfig(..., conflict_resolution=cr)\nexcept ValueError as e:\n    if \"Unknown conflict resolution\" in str(e):\n        cr = ConflictResolution(action=\"UPDATE\", update_fields=[\"embedding\"])\n        writer = MySqlVectorWriterConfig(..., conflict_resolution=cr)\n    else:\n        raise","preventionTips":["Use enum-like constants instead of raw strings for the action","Note the action strings are case-sensitive uppercase","Check the ConflictResolution docstring for the supported set before changing configs"],"tags":["python","mysql","rag","invalid-enum"],"backgroundTag":"invalid-enum-value","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"}