apache/beam · error · RuntimeError
Create disposition has to be one of the following…
Error message
Create disposition has to be one of the following values:CREATE_IF_NEEDED, CREATE_NEVER. Got: {} What it means
In Beam's Snowflake connector, CreateDisposition.VerifyParam checks that the given create-disposition string matches one of the class constants CREATE_IF_NEEDED or CREATE_NEVER. It raises RuntimeError when a truthy value does not correspond to any defined attribute, protecting against misspelled or unsupported disposition names.
Solutions
- Use the constant CreateDisposition.CREATE_IF_NEEDED or CreateDisposition.CREATE_NEVER instead of a raw string
- Fix casing — values must be uppercase exactly as defined
- Check for typos in the configured pipeline option
- Pass None/empty to leave the disposition unset (verification is skipped when falsy)
Example fix
// before snowflake.WriteToSnowflake(create_disposition='create_if_needed') // after from apache_beam.io.snowflake import CreateDisposition snowflake.WriteToSnowflake(create_disposition=CreateDisposition.CREATE_IF_NEEDED)
Defensive patterns
Strategy: validation
Validate before calling
from apache_beam.io.snowflake import CreateDisposition assert create_disposition in (None, '', CreateDisposition.CREATE_IF_NEEDED, CreateDisposition.CREATE_NEVER)
Type guard
def is_valid_create_disposition(v):
return not v or v in ('CREATE_IF_NEEDED', 'CREATE_NEVER') Try / catch
try:
transform = snowflake.WriteToSnowflake(create_disposition=cd)
except RuntimeError as e:
logger.error('Invalid create disposition: %s', e) Prevention
- Always use the CreateDisposition class constants, never raw strings
- Validate pipeline options from config files against the enum values
- Watch for case-sensitivity when values come from external configs
When it happens
Trigger: Passing a create_disposition value like 'create_if_needed' (wrong case), 'CREATE_IF_NESSED' (typo), or any string that is not exactly CREATE_IF_NEEDED / CREATE_NEVER to a Snowflake write transform.
Common situations: Copying Java Beam enum names with different casing, typos in pipeline options, or using a value valid in another connector but not Snowflake.
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
- Write disposition has to be one of the following…
- change_function must be 'CHANGES' or 'APPENDS', got
- Invalid create disposition
- Invalid PaneInfoEncoding
- Invalid schema update option
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/66d6a430e5338171.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/python/apache_beam/io/snowflake.py:458
self.expansion_service))
class CreateDisposition:
"""
Enum class for possible values of create dispositions:
CREATE_IF_NEEDED: default behaviour. The write operation checks whether
the specified target table exists; if it does not, the write operation
attempts to create the table Specify the schema for the target table
using the table_schema parameter.
CREATE_NEVER: The write operation fails if the target table does not exist.
"""
CREATE_IF_NEEDED = 'CREATE_IF_NEEDED'
CREATE_NEVER = 'CREATE_NEVER'
@staticmethod
def VerifyParam(field):
if field and not hasattr(CreateDisposition, field):
raise RuntimeError(
'Create disposition has to be one of the following values:'
'CREATE_IF_NEEDED, CREATE_NEVER. Got: {}'.format(field))
class WriteDisposition:
"""
Enum class for possible values of write dispositions:
APPEND: Default behaviour. Written data is added to the existing rows
in the table,
EMPTY: The target table must be empty; otherwise, the write operation fails,
TRUNCATE: The write operation deletes all rows from the target table
before writing to it.
"""
APPEND = 'APPEND'
EMPTY = 'EMPTY'
TRUNCATE = 'TRUNCATE'
@staticmethodView on GitHub (pinned to 12126d8942)