apache/beam · error · ValueError
Unknown conflict resolution
Error message
Unknown conflict resolution {conflict_resolution.action} What it means
_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.
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.
Example fix
// before ConflictResolution(action="UPSERT", update_fields=["embedding"]) // after ConflictResolution(action="UPDATE", update_fields=["embedding"])
Defensive patterns
Strategy: validation
Validate before calling
assert conflict_resolution.action in (None, 'UPDATE', 'IGNORE'), f"unsupported action {conflict_resolution.action!r}" Type guard
def is_valid_action(cr) -> bool:
return cr is None or cr.action in (None, "UPDATE", "IGNORE") Try / catch
try:
writer = MySqlVectorWriterConfig(..., conflict_resolution=cr)
except ValueError as e:
if "Unknown conflict resolution" in str(e):
cr = ConflictResolution(action="UPDATE", update_fields=["embedding"])
writer = MySqlVectorWriterConfig(..., conflict_resolution=cr)
else:
raise Prevention
- 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
When it happens
Trigger: Calling the MySQL RAG writer __init__ with ConflictResolution(action='SOMETHING_ELSE') — a typo like 'update' (lowercase), 'REPLACE', or 'UPSERT'.
Common situations: 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.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Duplicate column names found
- Expected chunk to contain embedding.
- primary_key_field is required when action='IGNORE'
- Approximate Nearest Neighbor Search (ANNS) field must be…
- chunk_to_dict_fn is deprecated, use embeddable_to_dict_fn
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/d8ce1375cd91d71c.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/python/apache_beam/ml/rag/ingestion/mysql.py:88
def __init__(self, primary_key_field: str):
self.primary_key_field = primary_key_field
def get_conflict_clause(self, all_columns: list[str]) -> str:
return f"ON DUPLICATE KEY UPDATE {self.primary_key_field}"\
f" = {self.primary_key_field}"
def _create_conflict_strategy(
conflict_resolution: Optional[ConflictResolution]
) -> _ConflictResolutionStrategy:
if conflict_resolution is None:
return _NoConflictStrategy()
if conflict_resolution.action == "UPDATE":
return _UpdateStrategy(conflict_resolution.update_fields)
if conflict_resolution.action == "IGNORE":
assert conflict_resolution.primary_key_field is not None
return _IgnoreStrategy(conflict_resolution.primary_key_field)
raise ValueError(f"Unknown conflict resolution {conflict_resolution.action}")
class _MySQLQueryBuilder:
def __init__(
self,
table_name: str,
*,
column_specs: list[ColumnSpec],
conflict_resolution: Optional[ConflictResolution] = None):
"""Builds SQL queries for writing EmbeddableItems with Embeddings to MySQL.
"""
self.table_name = table_name
self.column_specs = column_specs
self.conflict_resolution_strategy = _create_conflict_strategy(
conflict_resolution)
names = [col.column_name for col in self.column_specs]View on GitHub (pinned to 12126d8942)