{"record":{"id":"e2de3b10cb316aaa","repo":"deeplearning4j/deeplearning4j","slug":"invalid-argument-for-transformation-descriptor","errorCode":null,"errorMessage":"Invalid argument for transformation: ${descriptor.argType}","messagePattern":"Invalid argument for transformation: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"nd4j/samediff-import/samediff-import-api/src/main/kotlin/org/nd4j/samediff/frameworkimport/rule/tensor/PassThroughMultiTensorMapping.kt","lineNumber":133,"sourceCode":"        builder.ruleName = name()\n        builder.functionName = name()\n        builder.ruleType = \"tensor\"\n        builder.inputFrameworkOpName = inputFrameworkOpName()\n\n        for ((k, v) in transformerArgs) {\n            val descriptor = opDescriptor!!.argDescriptorList.filter { input -> input.name == k }[0]\n            when (descriptor.argType) {\n                OpNamespace.ArgDescriptor.ArgType.BOOL -> builder.addOutputBooleanName(k)\n                OpNamespace.ArgDescriptor.ArgType.INT64 -> builder.addOutputIntName(k)\n                OpNamespace.ArgDescriptor.ArgType.FLOAT -> builder.addOutputFloatName(k)\n                OpNamespace.ArgDescriptor.ArgType.DOUBLE -> builder.addOutputDoubleName(k)\n                OpNamespace.ArgDescriptor.ArgType.INT64 -> builder.addOutputIntName(k)\n                OpNamespace.ArgDescriptor.ArgType.INPUT_TENSOR -> builder.addInputTensorName(k)\n                OpNamespace.ArgDescriptor.ArgType.OUTPUT_TENSOR -> builder.addOutputTensorName(k)\n                OpNamespace.ArgDescriptor.ArgType.INT32 -> builder.addOutputIntName(k)\n                OpNamespace.ArgDescriptor.ArgType.DATA_TYPE -> builder.addInputDataTypeName(k)\n                OpNamespace.ArgDescriptor.ArgType.STRING -> builder.addOutputStringAttrName(k)\n                OpNamespace.ArgDescriptor.ArgType.UNRECOGNIZED -> throw IllegalArgumentException(\"Invalid argument for transformation: ${descriptor.argType}\")\n            }\n\n            for (associatedInput in v) {\n                when (associatedInput.argType) {\n                    OpNamespace.ArgDescriptor.ArgType.STRING -> builder.addInputStringAttrName(associatedInput.name)\n                    OpNamespace.ArgDescriptor.ArgType.BOOL -> builder.addInputBooleanName(associatedInput.name)\n                    OpNamespace.ArgDescriptor.ArgType.DOUBLE, OpNamespace.ArgDescriptor.ArgType.FLOAT -> builder.addInputFloatName(associatedInput.name)\n                    OpNamespace.ArgDescriptor.ArgType.INT32, OpNamespace.ArgDescriptor.ArgType.INT64 -> builder.addInputIntName(associatedInput.name)\n                    OpNamespace.ArgDescriptor.ArgType.INPUT_TENSOR -> builder.addInputTensorName(associatedInput.name)\n                    OpNamespace.ArgDescriptor.ArgType.DATA_TYPE -> builder.addInputDataTypeName(associatedInput.name)\n                    OpNamespace.ArgDescriptor.ArgType.OUTPUT_TENSOR -> builder.addOutputTensorName(associatedInput.name)\n                    OpNamespace.ArgDescriptor.ArgType.UNRECOGNIZED -> throw IllegalArgumentException(\"Invalid argument for transformation: ${associatedInput.argType}\")\n                }\n            }\n\n\n        }\n","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/deeplearning4j/deeplearning4j/blob/4c22ac5fe4a8350d05d224e7f4499429f7f69c93/nd4j/samediff-import/samediff-import-api/src/main/kotlin/org/nd4j/samediff/frameworkimport/rule/tensor/PassThroughMultiTensorMapping.kt#L115-L151","documentation":"PassThroughMultiTensorMapping.serialize() registers tensor/attribute names by ArgType; an UNRECOGNIZED argType throws this IllegalArgumentException ('Invalid argument for transformation'). The rule passes tensors through to the target op unchanged, so it cannot do anything with an argument whose type it cannot recognize. Note this rule routes DATA_TYPE to addInputDataTypeName while sibling rules route it to output — a known inconsistency worth checking when the error appears near data-type arguments.","triggerScenarios":"serialize() encounters descriptor.argType == ArgType.UNRECOGNIZED for key $k, from protobuf enum deserialization failure or a descriptor entry with unset/invalid type.","commonSituations":"Proto schema mismatch between modules; hand-written pass-through mapping config with bad argType; descriptors produced by a newer framework version not understood by the import library.","solutions":["Fix the descriptor's argType to a recognized ArgType value","Regenerate/align protobuf ArgDescriptor definitions across nd4j modules","Verify DATA_TYPE arguments are intentionally input-routed in this rule (else use another mapping rule)","Add load-time validation of argTypes in mapping configs"],"exampleFix":"// before\nOpNamespace.ArgDescriptor.ArgType.UNRECOGNIZED -> throw IllegalArgumentException(\"Invalid argument for transformation: ${descriptor.argType}\")\n// after\nOpNamespace.ArgDescriptor.ArgType.UNRECOGNIZED -> error(\"Unrecognized ArgType for '$k'; regenerate protobuf defs or fix mapping config\")","handlingStrategy":"validation","validationCode":"require(descriptor.argType != OpNamespace.ArgDescriptor.ArgType.UNRECOGNIZED) {\n    \"PassThroughMultiTensorMapping: '$k' has UNRECOGNIZED argType\"\n}","typeGuard":"fun isKnownArgType(d: OpNamespace.ArgDescriptor) = d.argType != OpNamespace.ArgDescriptor.ArgType.UNRECOGNIZED","tryCatchPattern":null,"preventionTips":["Confirm data-type arguments are input-routed before choosing PassThroughMultiTensorMapping","Keep descriptor protos and generated code version-aligned","Validate pass-through mapping configs against the ArgType enum at load time"],"tags":["kotlin","protobuf","tensor-mapping","enum"],"backgroundTag":"invalid-enum-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"}