{"record":{"id":"6f3dfe49cfab3c4b","repo":"hyperledger/fabric","slug":"chaincode-input-did-not-contain-any-input","errorCode":null,"errorMessage":"chaincode input did not contain any input","messagePattern":"chaincode input did not contain any input","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/endorser/msgvalidation.go","lineNumber":91,"sourceCode":"\t\treturn nil, errors.Errorf(\"ChaincodeHeaderExtension.ChaincodeId.Name is empty\")\n\t}\n\n\tcpp, err := protoutil.UnmarshalChaincodeProposalPayload(prop.Payload)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcis, err := protoutil.UnmarshalChaincodeInvocationSpec(cpp.Input)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif cis.ChaincodeSpec == nil {\n\t\treturn nil, errors.Errorf(\"chaincode invocation spec did not contain chaincode spec\")\n\t}\n\n\tif cis.ChaincodeSpec.Input == nil {\n\t\treturn nil, errors.Errorf(\"chaincode input did not contain any input\")\n\t}\n\n\tcppNoTransient := &peer.ChaincodeProposalPayload{Input: cpp.Input, TransientMap: nil}\n\tppBytes, err := proto.Marshal(cppNoTransient)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"could not marshal non-transient portion of payload\")\n\t}\n\n\t// TODO, this was preserved from the proputils stuff, but should this be BCCSP?\n\n\t// The proposal hash is the hash of the concatenation of:\n\t// 1) The serialized Channel Header object\n\t// 2) The serialized Signature Header object\n\t// 3) The hash of the part of the chaincode proposal payload that will go to the tx\n\t// (ie, the parts without the transient data)\n\tpropHash := sha256.New()\n\tpropHash.Write(hdr.ChannelHeader)\n\tpropHash.Write(hdr.SignatureHeader)","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/endorser/msgvalidation.go#L73-L109","documentation":"The ChaincodeInvocationSpec decoded from the proposal payload exists and has a ChaincodeSpec, but ChaincodeSpec.Input is nil. Input holds the function name and args to pass to the chaincode, so a proposal without it is not executable. The endorser rejects the proposal before any chaincode runs.","triggerScenarios":"ProcessProposal -> UnpackProposal receives a SignedProposal whose ChaincodeSpec was populated with ChaincodeId and Type but with Input left nil — e.g. building a query/invoke with no args, or a deploy-type spec without constructor args.","commonSituations":"SDK calls where the 'args' or 'fcn' parameter was omitted/empty, manually constructed ChaincodeSpec protobufs, chaincode upgrade/install proposals stripped of input during custom tooling transformations.","solutions":["Always populate ChaincodeSpec.Input with at least the function name and args (ChaincodeInput.Args) before signing the proposal.","Check the SDK client call passes a non-empty function/args list (e.g. contract.submitTransaction('fn', ...args)).","If using transient/private data flows, ensure the input is in the proposal, not moved entirely into the transient map."],"exampleFix":"// before\nspec := &pb.ChaincodeSpec{ChaincodeId: &pb.ChaincodeID{Name: \"mycc\"}}\n// after\nspec := &pb.ChaincodeSpec{\n    ChaincodeId: &pb.ChaincodeID{Name: \"mycc\"},\n    Input: &pb.ChaincodeInput{Args: [][]byte{[]byte(\"invoke\"), []byte(\"a\"), []byte(\"b\"), []byte(\"1\")}},\n}","handlingStrategy":"validation","validationCode":"if cis.ChaincodeSpec == nil || cis.ChaincodeSpec.Input == nil || len(cis.ChaincodeSpec.Input.Args) == 0 {\n    return errors.New(\"chaincode input/args required\")\n}","typeGuard":"func hasChaincodeInput(spec *pb.ChaincodeSpec) bool {\n    return spec != nil && spec.Input != nil && len(spec.Input.Args) > 0\n}","tryCatchPattern":null,"preventionTips":["Require function name and args in your submit wrapper API","Validate args before marshaling the proposal","Never build ChaincodeSpec without Input"],"tags":["hyperledger-fabric","endorser","proposal-validation","missing-args"],"backgroundTag":"chaincode-input-missing","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"}