{"record":{"id":"59f6bd3f39669512","repo":"hyperledger/fabric","slug":"vscc-error-invocation-of-lscc-s-does-not-have-a","errorCode":null,"errorMessage":"VSCC error: invocation of lscc(%s) does not have appropriate arguments","messagePattern":"VSCC error: invocation of lscc\\((.+?)\\) does not have appropriate arguments","errorType":"validation","errorClass":"VSCCEndorsementPolicyError","httpStatus":null,"severity":"error","filePath":"core/handlers/validation/builtin/v12/validation_logic.go","lineNumber":534,"sourceCode":"\t\tlogger.Debugf(\"VSCC info: validating invocation of lscc function %s on arguments %#v\", lsccFunc, lsccArgs)\n\n\t\tif len(lsccArgs) < 2 {\n\t\t\treturn policyErr(fmt.Errorf(\"Wrong number of arguments for invocation lscc(%s): expected at least 2, received %d\", lsccFunc, len(lsccArgs)))\n\t\t}\n\n\t\tif (!ac.PrivateChannelData() && len(lsccArgs) > 5) ||\n\t\t\t(ac.PrivateChannelData() && len(lsccArgs) > 6) {\n\t\t\treturn policyErr(fmt.Errorf(\"Wrong number of arguments for invocation lscc(%s): received %d\", lsccFunc, len(lsccArgs)))\n\t\t}\n\n\t\tcdsArgs, err := protoutil.UnmarshalChaincodeDeploymentSpec(lsccArgs[1])\n\t\tif err != nil {\n\t\t\treturn policyErr(fmt.Errorf(\"GetChaincodeDeploymentSpec error %s\", err))\n\t\t}\n\n\t\tif cdsArgs == nil || cdsArgs.ChaincodeSpec == nil || cdsArgs.ChaincodeSpec.ChaincodeId == nil ||\n\t\t\tcap.Action == nil || cap.Action.ProposalResponsePayload == nil {\n\t\t\treturn policyErr(fmt.Errorf(\"VSCC error: invocation of lscc(%s) does not have appropriate arguments\", lsccFunc))\n\t\t}\n\n\t\tswitch cdsArgs.ChaincodeSpec.Type.String() {\n\t\tcase \"GOLANG\", \"NODE\", \"JAVA\", \"CAR\":\n\t\tdefault:\n\t\t\treturn policyErr(fmt.Errorf(\"unexpected chaincode spec type: %s\", cdsArgs.ChaincodeSpec.Type.String()))\n\t\t}\n\n\t\t// validate chaincode name\n\t\tccName := cdsArgs.ChaincodeSpec.ChaincodeId.Name\n\t\t// it must comply with the lscc.ChaincodeNameRegExp\n\t\tif !lscc.ChaincodeNameRegExp.MatchString(ccName) {\n\t\t\treturn policyErr(errors.Errorf(\"invalid chaincode name '%s'\", ccName))\n\t\t}\n\t\t// it can't match the name of one of the system chaincodes\n\t\tif _, in := systemChaincodeNames[ccName]; in {\n\t\t\treturn policyErr(errors.Errorf(\"chaincode name '%s' is reserved for system chaincodes\", ccName))\n\t\t}","sourceCodeStart":516,"sourceCodeEnd":552,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/handlers/validation/builtin/v12/validation_logic.go#L516-L552","documentation":"After unmarshaling the ChaincodeDeploymentSpec, VSCC checks that the spec, its ChaincodeSpec, ChaincodeId, the ChaincodeActionPayload action and its ProposalResponsePayload are all non-nil. Any missing piece means the lscc invocation is structurally incomplete, so the transaction is rejected as a policy error.","triggerScenarios":"An lscc transaction whose deployment spec lacks ChaincodeSpec/ChaincodeId, or whose ChaincodeActionPayload has a nil Action or nil Action.ProposalResponsePayload — e.g. an endorsement response payload was never attached or was stripped.","commonSituations":"Malformed transactions built by custom scripts or buggy SDK versions that omit the proposal response payload in the action; tampered transactions during commit-time validation; partial payload assembly in custom endorsement flows.","solutions":["Ensure the signed ChaincodeActionPayload includes a ProposalResponsePayload with a non-nil Action (use protoutil.GetProposalResponsePayload helpers when building the transaction).","Confirm ChaincodeDeploymentSpec.ChaincodeSpec.ChaincodeId (name/version/path) is populated before submitting the deploy/upgrade.","Update the SDK or transaction-building code to a version that correctly assembles the full action payload."],"exampleFix":"// before: submitting action without proposal response payload\ncap.Action = nil\n// after: attach the endorsed proposal response payload\ncap.Action = &pb.ChaincodeEndorsedAction{\n    ProposalResponsePayload: prpBytes,\n    Endorsements:            endorsements,\n}","handlingStrategy":"validation","validationCode":"if cds == nil || cds.ChaincodeSpec == nil || cds.ChaincodeSpec.ChaincodeId == nil ||\n    cap.Action == nil || cap.Action.ProposalResponsePayload == nil {\n    return errors.New(\"incomplete lscc invocation payload\")\n}","typeGuard":"func hasCompleteLsccPayload(cds *pb.ChaincodeDeploymentSpec, cap *pb.ChaincodeActionPayload) bool {\n    return cds != nil && cds.ChaincodeSpec != nil && cds.ChaincodeSpec.ChaincodeId != nil &&\n        cap != nil && cap.Action != nil && cap.Action.ProposalResponsePayload != nil\n}","tryCatchPattern":"if !hasCompleteLsccPayload(cdsArgs, cap) {\n    logger.Warn(\"lscc invocation missing spec/action payload; rejecting\")\n    return policyErr(errors.New(\"incomplete lscc invocation\"))\n}","preventionTips":["Use the SDK's canonical transaction assembly instead of hand-building ChaincodeActionPayload.","Assert ChaincodeId name/version are set before deploy.","Never strip or rebuild ProposalResponsePayload bytes in intermediaries."],"tags":["fabric","vscc","lscc","malformed-transaction","validation"],"backgroundTag":"malformed-transaction-payload","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}