{"record":{"id":"6de6efa61825ddce","repo":"deeplearning4j/deeplearning4j","slug":"invalid-name-argdescriptorname-for-op-opdescript","errorCode":null,"errorMessage":"Invalid name $argDescriptorName for op $opDescriptorName passed in. $argDescriptorName not found in $opDescriptorName. Available names were ${names}","messagePattern":"Invalid name \\$argDescriptorName for op \\$opDescriptorName passed in\\. \\$argDescriptorName not found in \\$opDescriptorName\\. Available names were (.+?)","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"nd4j/samediff-import/samediff-import-api/src/main/kotlin/org/nd4j/samediff/frameworkimport/IRProtobufExtensions.kt","lineNumber":533,"sourceCode":"            }\n        }\n\n        else -> {\n            throw IllegalArgumentException(\"Illegal data type ${ndarray.dataType()}\")\n        }\n    }\n\n}\n\nfun lookupIndexForArgDescriptor(\n    argDescriptorName: String,\n    opDescriptorName: String,\n    argDescriptorType: OpNamespace.ArgDescriptor.ArgType\n): Int {\n    val op =  OpDescriptorLoaderHolder.nd4jOpDescriptor.findOp(opDescriptorName)\n    val names = op.argDescriptorList.map { argDescriptor -> argDescriptor.name }\n    if(!names.contains(argDescriptorName)) {\n        throw IllegalArgumentException(\"Invalid name $argDescriptorName for op $opDescriptorName passed in. $argDescriptorName not found in $opDescriptorName. Available names were ${names}\")\n    }\n    val ret =  op\n        .argDescriptorList.firstOrNull { argDescriptor -> argDescriptor.name == argDescriptorName &&\n                argDescriptor.argType == argDescriptorType }\n    if(ret == null)\n        return -1\n    else return ret.argIndex\n}\n\nfun createVariable(varName: String, varType: VariableType, sameDiff: SameDiff, shape: List<Long>, dataType: DataType): SDVariable {\n    return SDVariable(varName, varType, sameDiff, shape.toLongArray(), dataType)\n}\n\nfun descriptorsForName(\n    name: String,\n    argDescriptors: Collection<OpNamespace.ArgDescriptor>): List<OpNamespace.ArgDescriptor> {\n    return argDescriptors.filter { argDescriptor -> argDescriptor.name == name }!!\n}","sourceCodeStart":515,"sourceCodeEnd":551,"githubUrl":"https://github.com/deeplearning4j/deeplearning4j/blob/4c22ac5fe4a8350d05d224e7f4499429f7f69c93/nd4j/samediff-import/samediff-import-api/src/main/kotlin/org/nd4j/samediff/frameworkimport/IRProtobufExtensions.kt#L515-L551","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nlookupIndexForArgDescriptor(\"alphA\", \"BatchNorm\", ArgType.FLOAT) // typo -> throw\n// after\nlookupIndexForArgDescriptor(\"alpha\", \"BatchNorm\", ArgType.FLOAT) // matches op descriptor","handlingStrategy":"validation","validationCode":"val op = OpDescriptorLoaderHolder.nd4jOpDescriptor.findOp(opDescriptorName)\nval names = op.argDescriptorList.map { it.name }\nrequire(argDescriptorName in names) {\n    \"$argDescriptorName not in $opDescriptorName; available: $names\"\n}","typeGuard":"fun hasArgDescriptor(opName: String, argName: String): Boolean = runCatching {\n    OpDescriptorLoaderHolder.nd4jOpDescriptor.findOp(opName).argDescriptorList.any { it.name == argName }\n}.getOrDefault(false)","tryCatchPattern":"try {\n    val idx = lookupIndexForArgDescriptor(name, opName, argType)\n} catch (e: IllegalArgumentException) {\n    logger.warn(\"Arg name lookup failed: ${e.message}\")\n    return -1 // or skip attribute\n}","preventionTips":["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"],"tags":["kotlin","nd4j","op-descriptor","name-resolution"],"backgroundTag":"invalid-argument-value","analyzedSha":"4c22ac5fe4a8350d05d224e7f4499429f7f69c93","analyzedAt":"2026-09-07T05:27:04.714Z","contentChangedAt":"2026-09-07T05:27:04.714Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}