{"record":{"id":"45128fbe8ef03d38","repo":"hyperledger/fabric","slug":"nil-arguments-45128f","errorCode":null,"errorMessage":"nil arguments","messagePattern":"nil arguments","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"protoutil/txutils.go","lineNumber":360,"sourceCode":"\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &peer.ProposalResponse{\n\t\t// Timestamp: TODO!\n\t\tPayload:  prpBytes,\n\t\tResponse: response,\n\t}\n\n\treturn resp, nil\n}\n\n// GetSignedProposal returns a signed proposal given a Proposal message and a\n// signing identity\nfunc GetSignedProposal(prop *peer.Proposal, signer Signer) (*peer.SignedProposal, error) {\n\t// check for nil argument\n\tif prop == nil || signer == nil {\n\t\treturn nil, errors.New(\"nil arguments\")\n\t}\n\n\tpropBytes, err := proto.Marshal(prop)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsignature, err := signer.Sign(propBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &peer.SignedProposal{ProposalBytes: propBytes, Signature: signature}, nil\n}\n\n// MockSignedEndorserProposalOrPanic creates a SignedProposal with the\n// passed arguments\nfunc MockSignedEndorserProposalOrPanic(","sourceCodeStart":342,"sourceCodeEnd":378,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/protoutil/txutils.go#L342-L378","documentation":"GetSignedProposal returns a signed proposal by marshaling the Proposal and signing it with the provided signer. If either the proposal or the signer is nil, it returns the 'nil arguments' error, since neither a signature nor bytes can be produced.","triggerScenarios":"Calling GetSignedProposal(nil, signer), GetSignedProposal(prop, nil), or passing typed-nil values (nil interface holding nil *peer.Proposal / nil SigningIdentity) from unchecked earlier calls.","commonSituations":"Proposal construction failed earlier and nil was propagated; signing identity not initialized because MSP config/env was missing; SDK wrappers (ChaincodeInvokeOrQuery, executeJoin) hitting uninitialized client state.","solutions":["Verify both the Proposal and Signer are non-nil before calling GetSignedProposal","Check errors from the proposal constructor (CreateProposal) rather than ignoring them","Initialize the signing identity (local MSP / wallet) before invoking chaincode or join operations","On typed-nil interface risk, use an is-nil check that handles interface-wrapped nil pointers"],"exampleFix":"// before\nsignedProp, _ := protoutil.GetSignedProposal(prop, signer) // prop or signer may be nil\n// after\nif prop == nil || signer == nil {\n    return nil, fmt.Errorf(\"proposal and signer required\")\n}\nsignedProp, err := protoutil.GetSignedProposal(prop, signer)\nif err != nil {\n    return nil, err\n}","handlingStrategy":"type-guard","validationCode":"func canSign(prop *peer.Proposal, signer protoutil.Signer) error {\n    if prop == nil {\n        return fmt.Errorf(\"proposal is nil\")\n    }\n    if signer == nil {\n        return fmt.Errorf(\"signer is nil\")\n    }\n    return nil\n}","typeGuard":"func isNilDeep(v interface{}) bool {\n    if v == nil { return true }\n    rv := reflect.ValueOf(v)\n    switch rv.Kind() {\n    case reflect.Ptr, reflect.Interface, reflect.Map, reflect.Slice:\n        return rv.IsNil()\n    }\n    return false\n}","tryCatchPattern":"if err := canSign(prop, signer); err != nil {\n    return nil, err\n}\nsignedProp, err := protoutil.GetSignedProposal(prop, signer)\nif err != nil {\n    return nil, fmt.Errorf(\"sign proposal: %w\", err)\n}","preventionTips":["Check the error return of CreateProposal before using the proposal","Initialize the signing identity during client setup and validate it","Use a deep-nil helper for interface-typed pointers to catch typed nils"],"tags":["signing","nil-pointer","hyperledger-fabric","validation"],"backgroundTag":"nil-argument-validation","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}