{"record":{"id":"5cd5b555d067851f","repo":"hyperledger/fabric","slug":"failed-to-marshal-args-5cd5b5","errorCode":null,"errorMessage":"failed to marshal args","messagePattern":"failed to marshal args","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/lifecycle/chaincode/queryinstalled.go","lineNumber":156,"sourceCode":"func (i *InstalledQuerier) printResponse(proposalResponse *pb.ProposalResponse) error {\n\tqicr := &lb.QueryInstalledChaincodesResult{}\n\terr := proto.Unmarshal(proposalResponse.Response.Payload, qicr)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to unmarshal proposal response's response payload\")\n\t}\n\tfmt.Fprintln(i.Writer, \"Installed chaincodes on peer:\")\n\tfor _, chaincode := range qicr.InstalledChaincodes {\n\t\tfmt.Fprintf(i.Writer, \"Package ID: %s, Label: %s\\n\", chaincode.PackageId, chaincode.Label)\n\t}\n\treturn nil\n}\n\nfunc (i *InstalledQuerier) createProposal() (*pb.Proposal, error) {\n\targs := &lb.QueryInstalledChaincodesArgs{}\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(\"QueryInstalledChaincodes\"), 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":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/lifecycle/chaincode/queryinstalled.go#L138-L174","documentation":"This error is returned by InstalledQuerier.createProposal in the `peer chaincode queryinstalled` command when protobuf serialization of the empty lb.QueryInstalledChaincodesArgs message fails. The args message is empty, so marshaling practically never fails; the wrap exists to surface any proto subsystem failure with context before building the ChaincodeInput proposal for the _lifecycle system chaincode.","triggerScenarios":"Calling Query -> createProposal when proto.Marshal(args) returns a non-nil error; essentially only occurs if the proto registry/runtime is corrupted or the generated type registration is broken in a custom build.","commonSituations":"Custom or patched Fabric builds with mismatched _lifecycle protobuf definitions; vendoring issues where generated pb.go files are out of sync with the protobuf library version; exotic proto compilation/tag errors.","solutions":["Rebuild the peer CLI from unmodified Fabric source so the _lifecycle protobuf types are generated consistently.","Check that the protobuf dependency versions (google.golang.org/protobuf vs github.com/golang/protobuf) are aligned in your build.","Inspect the wrapped underlying proto error (errors.Wrap keeps the cause) to identify the exact marshal failure and fix the offending message type registration."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if _, err := proto.Marshal(&lb.QueryInstalledChaincodesArgs{}); err != nil { return fmt.Errorf(\"proto runtime broken: %w\", err) }","typeGuard":null,"tryCatchPattern":"if err := runQueryInstalled(); err != nil {\n    if strings.Contains(err.Error(), \"failed to marshal args\") {\n        log.Fatalf(\"proto registry/build issue: %v\", err)\n    }\n    return err\n}","preventionTips":["Build the CLI from unmodified upstream Fabric sources.","Keep protobuf runtime and generated code versions aligned.","Run peer CLI unit tests that exercise _lifecycle queries before deployment."],"tags":["fabric","peer-cli","protobuf"],"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"}