deeplearning4j/deeplearning4j · error · java.lang.IllegalArgumentException
Invalid name $argDescriptorName for op $opDescriptorName…
Error message
Invalid name $argDescriptorName for op $opDescriptorName passed in. $argDescriptorName not found in $opDescriptorName. Available names were ${names} What it means
lookupIndexForArgDescriptor resolves an argument name to its argIndex within a registered op's descriptor list (loaded via OpDescriptorLoaderHolder.nd4jOpDescriptor.findOp). If the given argDescriptorName does not appear among the op's known argDescriptor names, this IllegalArgumentException is thrown listing the available names. It means the code referenced an argument (attribute/input flag) that does not exist for that op in the loaded op descriptor registry.
Solutions
- Check the 'Available names were' list in the message and use the exact matching argument name (watch case/underscore)
- Align versions: update the import rule/op-definition resources and the nd4j op descriptor set to the same release
- Verify opDescriptorName resolves to the intended op (print op.opName/argDescriptorList) — a wrong op name silently changes the available names
- Guard with a pre-check: names.contains(argDescriptorName) before calling, or catch IllegalArgumentException and log the op schema
Example fix
// before
lookupIndexForArgDescriptor("alphA", "BatchNorm", ArgType.FLOAT) // typo -> throw
// after
lookupIndexForArgDescriptor("alpha", "BatchNorm", ArgType.FLOAT) // matches op descriptor Defensive patterns
Strategy: validation
Validate before calling
val op = OpDescriptorLoaderHolder.nd4jOpDescriptor.findOp(opDescriptorName)
val names = op.argDescriptorList.map { it.name }
require(argDescriptorName in names) {
"$argDescriptorName not in $opDescriptorName; available: $names"
} Type guard
fun hasArgDescriptor(opName: String, argName: String): Boolean = runCatching {
OpDescriptorLoaderHolder.nd4jOpDescriptor.findOp(opName).argDescriptorList.any { it.name == argName }
}.getOrDefault(false) Try / catch
try {
val idx = lookupIndexForArgDescriptor(name, opName, argType)
} catch (e: IllegalArgumentException) {
logger.warn("Arg name lookup failed: ${e.message}")
return -1 // or skip attribute
} Prevention
- Copy argument names exactly from the op descriptor (watch case and underscores)
- Regenerate import rule files with the same nd4j version as the runtime
- Log the available names from the exception before fixing
- Verify opDescriptorName maps to the intended framework op
When it happens
Trigger: Calling lookupIndexForArgDescriptor(name, opName, type) — directly or from convertAttributes/convertInput during model import — with an argument name absent from the op's argDescriptorList, often because of a typo, case mismatch, or an op-definition resource file that predates the argument.
Common situations: Framework version mismatch: importer rule files/reference ops generated against a newer nd4j op schema than the bundled op descriptor YAML; renamed op arguments between versions; op names registered under different onnx/tf mapping names.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Found invalid input tensor named
- Found invalid output tensor named
- Illegal data type
- Illegal type
- Illegal type found for conversion
AI-assisted analysis of deeplearning4j/deeplearning4j@4c22ac5fe4 (2026-09-07).
Data as JSON: /api/errors/6de6efa61825ddce.
Report an issue: GitHub.
Appendix: source
Thrown at nd4j/samediff-import/samediff-import-api/src/main/kotlin/org/nd4j/samediff/frameworkimport/IRProtobufExtensions.kt:533
}
}
else -> {
throw IllegalArgumentException("Illegal data type ${ndarray.dataType()}")
}
}
}
fun lookupIndexForArgDescriptor(
argDescriptorName: String,
opDescriptorName: String,
argDescriptorType: OpNamespace.ArgDescriptor.ArgType
): Int {
val op = OpDescriptorLoaderHolder.nd4jOpDescriptor.findOp(opDescriptorName)
val names = op.argDescriptorList.map { argDescriptor -> argDescriptor.name }
if(!names.contains(argDescriptorName)) {
throw IllegalArgumentException("Invalid name $argDescriptorName for op $opDescriptorName passed in. $argDescriptorName not found in $opDescriptorName. Available names were ${names}")
}
val ret = op
.argDescriptorList.firstOrNull { argDescriptor -> argDescriptor.name == argDescriptorName &&
argDescriptor.argType == argDescriptorType }
if(ret == null)
return -1
else return ret.argIndex
}
fun createVariable(varName: String, varType: VariableType, sameDiff: SameDiff, shape: List<Long>, dataType: DataType): SDVariable {
return SDVariable(varName, varType, sameDiff, shape.toLongArray(), dataType)
}
fun descriptorsForName(
name: String,
argDescriptors: Collection<OpNamespace.ArgDescriptor>): List<OpNamespace.ArgDescriptor> {
return argDescriptors.filter { argDescriptor -> argDescriptor.name == name }!!
}View on GitHub (pinned to 4c22ac5fe4)