{"record":{"id":"38badab7efb7b256","repo":"hyperledger/fabric","slug":"signer-is-required-when-creating-a-signed-transact","errorCode":null,"errorMessage":"signer is required when creating a signed transaction","messagePattern":"signer is required when creating a signed transaction","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"protoutil/txutils.go","lineNumber":148,"sourceCode":"\tSign(msg []byte) ([]byte, error)\n\tSerialize() ([]byte, error)\n}\n\n// CreateSignedTx assembles an Envelope message from proposal, endorsements,\n// and a signer. This function should be called by a client when it has\n// collected enough endorsements for a proposal to create a transaction and\n// submit it to peers for ordering\nfunc CreateSignedTx(\n\tproposal *peer.Proposal,\n\tsigner Signer,\n\tresps ...*peer.ProposalResponse,\n) (*common.Envelope, error) {\n\tif len(resps) == 0 {\n\t\treturn nil, errors.New(\"at least one proposal response is required\")\n\t}\n\n\tif signer == nil {\n\t\treturn nil, errors.New(\"signer is required when creating a signed transaction\")\n\t}\n\n\t// the original header\n\thdr, err := UnmarshalHeader(proposal.Header)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// the original payload\n\tpPayl, err := UnmarshalChaincodeProposalPayload(proposal.Payload)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// check that the signer is the same that is referenced in the header\n\tsignerBytes, err := signer.Serialize()\n\tif err != nil {\n\t\treturn nil, err","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/protoutil/txutils.go#L130-L166","documentation":"CreateSignedTx requires a Signer to sign the assembled transaction; if the signer parameter is nil it returns this error. Even with valid proposal and responses, no signature can be produced without a signing identity.","triggerScenarios":"Calling CreateSignedTx(proposal, nil, resps...) or passing a nil-valued interface (e.g. a nil *msp.SigningIdentity stored in an interface) returned by an unchecked identity lookup.","commonSituations":"Client not properly initialized with an MSP/signing identity; identity loaded after a config/env var miss; a SigningIdentity variable left nil because credential files were missing.","solutions":["Pass a valid signing identity (e.g. from msp.NewSigningIdentity or the local MSP) to CreateSignedTx","Check that the local MSP and signing identity are loaded before transaction assembly","Verify keystore/certificate paths and that identity retrieval returned non-nil (check err, not just value)","If the code path allows unsigned operation, use the appropriate constructor instead of CreateSignedTx"],"exampleFix":"// before\nenv, err := protoutil.CreateSignedTx(proposal, nil, resps...)\n// after\nsigner, err := localMSP.GetDefaultSigningIdentity()\nif err != nil {\n    return nil, err\n}\nenv, err := protoutil.CreateSignedTx(proposal, signer, resps...)","handlingStrategy":"type-guard","validationCode":"func requireSigner(signer protoutil.Signer) error {\n    if signer == nil {\n        return fmt.Errorf(\"signing identity not loaded\")\n    }\n    return nil\n}","typeGuard":"func hasSigner(s protoutil.Signer) bool {\n    if s == nil { return false }\n    v := reflect.ValueOf(s)\n    return !(v.Kind() == reflect.Ptr && v.IsNil())\n}","tryCatchPattern":"signer, err := localMSP.GetDefaultSigningIdentity()\nif err != nil || signer == nil {\n    return nil, fmt.Errorf(\"no signing identity: %w\", err)\n}\ntx, err := protoutil.CreateSignedTx(proposal, signer, resps...)","preventionTips":["Load and verify the signing identity at client startup, not at tx assembly time","Check both err and nil on identity lookups (typed-nil interface pitfall)","Verify keystore/cert paths in MSP configuration"],"tags":["signing","identity","hyperledger-fabric","missing-argument"],"backgroundTag":"missing-signer-identity","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"}