apache/seatunnel · error · java.lang.IllegalArgumentException
Cannot resolve insert strategy: [%s]. Supported values are:
Error message
Cannot resolve insert strategy: [%s]. Supported values are: '%s', '%s'
What it means
The MaxcomputeOutputFormat constructor reads the insert_strategy config and only accepts 'upload_session' or 'upsert_session'; any other value throws IllegalArgumentException at sink initialization. This fails fast before writing any data.
Source
Thrown at seatunnel-connectors-v2/connector-maxcompute/src/main/java/org/apache/seatunnel/connectors/seatunnel/maxcompute/util/MaxcomputeOutputFormat.java:69
private RecordWriter recordWriter;
private UpsertStream upsertStream;
private TableTunnel.UploadSession uploadSession;
private TableTunnel.UpsertSession upsertSession;
public MaxcomputeOutputFormat(SeaTunnelRowType rowType, ReadonlyConfig readonlyConfig) {
this.rowType = rowType;
this.readonlyConfig = readonlyConfig;
this.tableSchema = MaxcomputeUtil.getTable(readonlyConfig).getSchema();
this.formatterContext =
new FormatterContext(readonlyConfig.get(FormatOptions.DATETIME_FORMAT));
String insertStrategy = readonlyConfig.get(MaxcomputeSinkOptions.INSERT_STRATEGY);
if (UPLOAD_SESSION.equals(insertStrategy)) {
isUploadSession = true;
} else if (UPSERT_SESSION.equals(insertStrategy)) {
isUploadSession = false;
} else {
throw new IllegalArgumentException(
String.format(
"Cannot resolve insert strategy: [%s]. Supported values are: '%s', '%s'",
insertStrategy, UPLOAD_SESSION, UPSERT_SESSION));
}
}
public void write(SeaTunnelRow seaTunnelRow) throws IOException, TunnelException {
switch (seaTunnelRow.getRowKind()) {
case INSERT:
if (isUploadSession) {
insertRecord(seaTunnelRow);
} else {
upsertRecord(seaTunnelRow);
}
break;
case UPDATE_AFTER:
upsertRecord(seaTunnelRow);
break;View on GitHub (pinned to cf67b549a7)
Solutions
- Set insert_strategy to exactly 'upload_session' or 'upsert_session' (lowercase)
- Check the current option default and accepted values in MaxcomputeSinkOptions/docs
- Trim/normalize the value in your config generation script before writing the job file
Example fix
// before insert_strategy = "UPSERT_SESSION" // after insert_strategy = "upsert_session"
Defensive patterns
Strategy: validation
Validate before calling
String s = readonlyConfig.get(MaxcomputeSinkOptions.INSERT_STRATEGY);
if (!"upload_session".equals(s) && !"upsert_session".equals(s)) {
throw new IllegalArgumentException("insert_strategy must be 'upload_session' or 'upsert_session': " + s);
} Try / catch
try { new MaxcomputeOutputFormat(readonlyConfig); }
catch (IllegalArgumentException e) { /* fix config and retry job submission */ } Prevention
- Use the exact lowercase constants for insert_strategy
- Keep option values in sync with current connector docs
- Validate job configs before submission (config validation tooling)
When it happens
Trigger: Configuring sink option INSERT_STRATEGY (insert_strategy) with a typo'd or unsupported value like 'session', 'append', or 'UPSERT' (wrong casing/whitespace) in the HOCON job config.
Common situations: Copy-pasting config from another connector; using uppercase values when the constants are lowercase; leftover option from an older connector version with different accepted values.
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
- CREATE_HIVE_TABLE_FAILED
- The configuration of 'overwrite' is deprecated, please use '
- Unknown format type:
- Unsupported data format type:
- Option 'field_delimiter' cannot be empty
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/68698a09753e5fe1.
Report an issue: GitHub.