apache/seatunnel · error · HiveConnectorException
CREATE_HIVE_TABLE_FAILED
CREATE_HIVE_TABLE_FAILED
Error message
Unsupported schema save mode:
What it means
Hive sink's schema save mode switch (handleSchemaSaveMode) only supports the known modes (CREATE_SCHEMA_WHEN_NOT_EXIST, RECREATE_SCHEMA, ERROR, IGNORE); any other value hits the default branch and throws HiveConnectorException(CREATE_HIVE_TABLE_FAILED). This guards against misspelled or invalid schema_save_mode values.
Source
Thrown at seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/sink/HiveSaveModeHandler.java:129
try {
switch (schemaSaveMode) {
case RECREATE_SCHEMA:
handleRecreateSchema();
break;
case CREATE_SCHEMA_WHEN_NOT_EXIST:
handleCreateSchemaWhenNotExist();
break;
case ERROR_WHEN_SCHEMA_NOT_EXIST:
handleErrorWhenSchemaNotExist();
break;
case IGNORE:
log.info(
"Ignore schema save mode, skip schema handling for table {}.{}",
dbName,
tableName);
break;
default:
throw new HiveConnectorException(
HiveConnectorErrorCode.CREATE_HIVE_TABLE_FAILED,
"Unsupported schema save mode: " + schemaSaveMode);
}
} catch (HiveConnectorException e) {
throw e;
} catch (TException e) {
throw new HiveConnectorException(
HiveConnectorErrorCode.CREATE_HIVE_TABLE_FAILED,
"Failed to handle schema save mode: " + e.getMessage(),
e);
}
}
@Override
public void handleDataSaveMode() {
// No-op: data cleanup is handled in AggregatedCommitter via overwrite or DROP_DATA
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Set schema_save_mode to exactly one of: CREATE_SCHEMA_WHEN_NOT_EXIST, RECREATE_SCHEMA, ERROR, IGNORE (check the connector docs for exact accepted strings).
- Check for typos/case mismatch in the config key value — matching is exact string comparison.
- Compare against the version-appropriate documentation; option values can differ between SeaTunnel releases.
- Print/log the resolved config value to confirm what the job actually parsed.
Example fix
// before schema_save_mode = "CREATE_IF_NOT_EXIST" // after schema_save_mode = "CREATE_SCHEMA_WHEN_NOT_EXIST"
Defensive patterns
Strategy: validation
Validate before calling
Set<String> allowed = Set.of("CREATE_SCHEMA_WHEN_NOT_EXIST","RECREATE_SCHEMA","ERROR","IGNORE");
if (!allowed.contains(config.get("schema_save_mode"))) throw new IllegalArgumentException("schema_save_mode must be one of " + allowed); Try / catch
try {
sink.open(...);
} catch (HiveConnectorException e) {
if (e.getErrorCode() == HiveConnectorErrorCode.CREATE_HIVE_TABLE_FAILED
&& e.getMessage().startsWith("Unsupported schema save mode")) {
// fix schema_save_mode value and resubmit
}
} Prevention
- Copy enum values verbatim from the connector documentation.
- Use an enum/constant in generated configs rather than free text.
- Add schema validation of the HOCON config in CI.
- Strip whitespace and enforce exact casing in config templating.
When it happens
Trigger: Configuring the Hive sink with a schema_save_mode (schema save mode) string that is not one of the supported enum values, reaching handleSchemaSaveMode's switch default. Called via handleSchemaSaveModeWithRestore at sink initialization.
Common situations: Typo such as 'create_schema_when_not_exists' with wrong casing or extra spaces; copying config from an older/newer SeaTunnel version with different option names; template placeholders left unfilled.
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
- Cannot resolve insert strategy: [%s]. Supported values are:
- Unknown format type:
- Unsupported data format type:
- Option 'field_delimiter' cannot be empty
- Option 'max_in_flight' must be greater than zero
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/5649dda9aee8a657.
Report an issue: GitHub.