deeplearning4j/deeplearning4j · error · IllegalArgumentException
Right key columns are not set (null
Error message
Right key columns are not set (null
What it means
Join.getOutputSchema() throws this IllegalArgumentException when joinColumnsRight is null. Note the message itself has a typo (missing closing paren) and this case uses IllegalArgumentException while the left counterpart uses IllegalStateException.
Solutions
- Add setJoinColumnsRight(keyColumns) with names present in the right schema
- Verify the builder chain includes both key-column setters
- Keep left/right key lists constructed together in code
Example fix
// before
Join join = new Join.Builder(Join.JoinType.Inner)
.setLeftSchema(leftSchema).setRightSchema(rightSchema)
.setJoinColumnsLeft("userId").build();
// after
Join join = new Join.Builder(Join.JoinType.Inner)
.setLeftSchema(leftSchema).setRightSchema(rightSchema)
.setJoinColumnsLeft("userId").setJoinColumnsRight("userId").build(); Defensive patterns
Strategy: validation
Validate before calling
if (joinColumnsRight == null || joinColumnsRight.length == 0)
throw new IllegalStateException("setJoinColumnsRight must be called with at least one key column"); Try / catch
try {
Schema out = join.getOutputSchema();
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Right key columns are not set")) {
// rebuild join with right key columns
}
} Prevention
- Always pair setJoinColumnsLeft with setJoinColumnsRight
- Build both key arrays from a shared key-name constant
- Call build() which validates configuration before use
When it happens
Trigger: Building a Join with schemas and setJoinColumnsLeft set but omitting setJoinColumnsRight(...) before calling getOutputSchema().
Common situations: Same as the left-side variant: assuming defaults, or one-sided setter after refactoring.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Cannot build Join: left and/or right schemas are null
- Left key columns are not set (null)
- Cannot join examples: Both examples are null (max 1 allowed…
- Cannot perform join: right join column "
- Join type cannot be null
AI-assisted analysis of deeplearning4j/deeplearning4j@4c22ac5fe4 (2026-09-07).
Data as JSON: /api/errors/90b83e4058e72a95.
Report an issue: GitHub.
Appendix: source
Thrown at datavec/datavec-api/src/main/java/org/datavec/api/transform/join/Join.java:188
public Join build() {
if (leftSchema == null || rightSchema == null)
throw new IllegalStateException("Cannot build Join: left and/or right schemas are null");
return new Join(this);
}
}
public Schema getOutputSchema() {
if (leftSchema == null)
throw new IllegalStateException("Left schema is not set (null)");
if (rightSchema == null)
throw new IllegalStateException("Right schema is not set (null)");
if (joinColumnsLeft == null)
throw new IllegalStateException("Left key columns are not set (null)");
if (joinColumnsRight == null)
throw new IllegalArgumentException("Right key columns are not set (null");
//Approach here: take the left schema, plus the right schema (excluding the key columns from the right schema)
List<ColumnMetaData> metaDataOut = new ArrayList<>(leftSchema.getColumnMetaData());
Set<String> keySetRight = new HashSet<>();
Collections.addAll(keySetRight, joinColumnsRight);
for (ColumnMetaData rightMeta : rightSchema.getColumnMetaData()) {
if (keySetRight.contains(rightMeta.getName()))
continue;
metaDataOut.add(rightMeta);
}
return leftSchema.newSchema(metaDataOut);
}
/**
* Join the examples.View on GitHub (pinned to 4c22ac5fe4)