{"record":{"id":"efd0d7de4fdcfce2","repo":"hyperledger/fabric","slug":"chaincodeheaderextension-chaincodeid-name-is-empty","errorCode":null,"errorMessage":"ChaincodeHeaderExtension.ChaincodeId.Name is empty","messagePattern":"ChaincodeHeaderExtension\\.ChaincodeId\\.Name is empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/endorser/msgvalidation.go","lineNumber":73,"sourceCode":"\t\treturn nil, err\n\t}\n\n\tshdr, err := protoutil.UnmarshalSignatureHeader(hdr.SignatureHeader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tchaincodeHdrExt, err := protoutil.UnmarshalChaincodeHeaderExtension(chdr.Extension)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif chaincodeHdrExt.ChaincodeId == nil {\n\t\treturn nil, errors.Errorf(\"ChaincodeHeaderExtension.ChaincodeId is nil\")\n\t}\n\n\tif chaincodeHdrExt.ChaincodeId.Name == \"\" {\n\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\")","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/endorser/msgvalidation.go#L55-L91","documentation":"After confirming ChaincodeId is non-nil, UnpackProposal also requires the chaincode name to be non-empty; a proposal targeting an unnamed chaincode cannot be executed, so it is rejected with this error.","triggerScenarios":"Submitting a proposal whose ChaincodeHeaderExtension.ChaincodeId.Name is the empty string — typically a default-constructed ChaincodeID in the header extension.","commonSituations":"Hand-built proposals in tests/scripts forgetting to set the chaincode name; SDK misconfiguration where the chaincode name is empty/unset; template code with placeholder names.","solutions":["Set ChaincodeId.Name (and Version) in the ChaincodeHeaderExtension when constructing the proposal","Fix SDK/client configuration so the chaincode name is provided","Add client-side validation that the chaincode name is non-empty before submitting"],"exampleFix":"// before\nccID := &pb.ChaincodeID{} // Name empty\n// after\nccID := &pb.ChaincodeID{Name: \"mycc\", Version: \"1.0\"}","handlingStrategy":"validation","validationCode":"if ext.ChaincodeId == nil || ext.ChaincodeId.Name == \"\" {\n    return errors.New(\"chaincode name must be non-empty\")\n}","typeGuard":"func hasChaincodeName(ext *pb.ChaincodeHeaderExtension) bool {\n    return ext != nil && ext.ChaincodeId != nil && ext.ChaincodeId.Name != \"\"\n}","tryCatchPattern":null,"preventionTips":["Verify the chaincode name is configured in the client before building proposals","Reject empty-name chaincode IDs at proposal-construction time","Use constants/config for chaincode names rather than empty placeholders"],"tags":["endorser","proposal-validation","header-extension","chaincode-name"],"backgroundTag":"chaincode-header-extension-invalid","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"}