{"record":{"id":"85e52ca63f3ab9e5","repo":"hyperledger/fabric","slug":"failed-to-marshal-args","errorCode":null,"errorMessage":"failed to marshal args","messagePattern":"failed to marshal args","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/peer/lifecycle/chaincode/getinstalledpackage.go","lineNumber":181,"sourceCode":"\n\terr = i.Writer.WriteFile(dir, name, result.ChaincodeInstallPackage)\n\tif err != nil {\n\t\terr = errors.Wrapf(err, \"failed to write chaincode package to %s\", outputFile)\n\t\tlogger.Error(err.Error())\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (i *InstalledPackageGetter) createProposal() (*pb.Proposal, error) {\n\targs := &lb.GetInstalledChaincodePackageArgs{\n\t\tPackageId: i.Input.PackageID,\n\t}\n\n\targsBytes, err := proto.Marshal(args)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to marshal args\")\n\t}\n\n\tccInput := &pb.ChaincodeInput{\n\t\tArgs: [][]byte{[]byte(\"GetInstalledChaincodePackage\"), argsBytes},\n\t}\n\n\tcis := &pb.ChaincodeInvocationSpec{\n\t\tChaincodeSpec: &pb.ChaincodeSpec{\n\t\t\tChaincodeId: &pb.ChaincodeID{Name: lifecycleName},\n\t\t\tInput:       ccInput,\n\t\t},\n\t}\n\n\tsignerSerialized, err := i.Signer.Serialize()\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"failed to serialize identity\")\n\t}\n","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/lifecycle/chaincode/getinstalledpackage.go#L163-L199","documentation":"createProposal() failed to proto-marshal the GetInstalledChaincodePackageArgs struct into bytes before building the chaincode input. This is nearly impossible in normal operation since the args contain a single string field, and indicates a serialization-layer failure.","triggerScenarios":"proto.Marshal(args) returns an error while constructing the GetInstalledChaincodePackage proposal from i.Input.PackageID.","commonSituations":"Generated protobuf code/registry mismatch between the CLI binary and its vendored gogo/protobuf runtime; corrupted or stripped binary builds; practically never seen in normal usage.","solutions":["Rebuild the peer CLI binary from matching Fabric sources/tag.","Ensure the binary uses the Fabric-vendored protobuf libraries (no dependency overrides).","Retry with an official Fabric release binary instead of a custom build."],"exampleFix":"// before: custom build with replaced proto deps\ngo build -mod=mod ./cmd/peer\n// after: use vendored Fabric deps\ngo build -mod=vendor ./cmd/peer","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"proposal, err := createProposal(...)\nif err != nil && strings.Contains(err.Error(), \"failed to marshal args\") {\n    // rebuild binary with correct Fabric deps and retry\n}","preventionTips":["Build with Fabric's vendored dependencies","Avoid replacing gogo/protobuf with different versions","Use official release binaries in CI"],"tags":["fabric","protobuf","marshal","serialization"],"backgroundTag":"protobuf-marshal-failed","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"}