{"record":{"id":"6d2e98314649d113","repo":"hyperledger/fabric","slug":"no-chaincode-spec-is-provided-channel-id-s","errorCode":null,"errorMessage":"no chaincode spec is provided, channel id [%s]","messagePattern":"no chaincode spec is provided, channel id \\[(.+?)\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pkg/gateway/evaluate.go","lineNumber":143,"sourceCode":"\tchannelHeader, err := protoutil.UnmarshalChannelHeader(header.GetChannelHeader())\n\tif err != nil {\n\t\treturn \"\", \"\", false, err\n\t}\n\tpayload, err := protoutil.UnmarshalChaincodeProposalPayload(proposal.GetPayload())\n\tif err != nil {\n\t\treturn \"\", \"\", false, err\n\t}\n\tspec, err := protoutil.UnmarshalChaincodeInvocationSpec(payload.GetInput())\n\tif err != nil {\n\t\treturn \"\", \"\", false, err\n\t}\n\n\tif len(channelHeader.GetChannelId()) == 0 {\n\t\treturn \"\", \"\", false, fmt.Errorf(\"no channel id provided\")\n\t}\n\n\tif spec.GetChaincodeSpec() == nil {\n\t\treturn \"\", \"\", false, fmt.Errorf(\"no chaincode spec is provided, channel id [%s]\", channelHeader.GetChannelId())\n\t}\n\n\tif spec.GetChaincodeSpec().GetChaincodeId() == nil {\n\t\treturn \"\", \"\", false, fmt.Errorf(\"no chaincode id is provided, channel id [%s]\", channelHeader.GetChannelId())\n\t}\n\n\tif len(spec.GetChaincodeSpec().GetChaincodeId().GetName()) == 0 {\n\t\treturn \"\", \"\", false, fmt.Errorf(\"no chaincode name is provided, channel id [%s]\", channelHeader.GetChannelId())\n\t}\n\n\treturn channelHeader.GetChannelId(), spec.GetChaincodeSpec().GetChaincodeId().GetName(), len(payload.TransientMap) > 0, nil\n}\n\nfunc getResultFromProposalResponse(proposalResponse *peer.ProposalResponse) ([]byte, error) {\n\tresponsePayload := &peer.ProposalResponsePayload{}\n\tif err := proto.Unmarshal(proposalResponse.GetPayload(), responsePayload); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to deserialize proposal response payload\")\n\t}","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/pkg/gateway/evaluate.go#L125-L161","documentation":"Returned by getChannelAndChaincodeFromSignedProposal (internal/pkg/gateway/evaluate.go:143) when the invocation spec extracted from the proposal has a nil ChaincodeSpec. The proposal parsed successfully and had a channel, but the chaincode invocation details are missing. The gateway cannot determine what chaincode to query.","triggerScenarios":"Evaluate called with a proposal whose ChaincodeInvocationSpec has no ChaincodeSpec set — e.g. payload.Input marshalled with an empty or default ChaincodeInvocationSpec.","commonSituations":"Manually building the payload without invoking spec.ChaincodeSpec = &peer.ChaincodeSpec{...}; deserializing a proposal created by a tool that omits the spec; template proposals copied without the invocation section.","solutions":["Populate ChaincodeSpec (chaincode id/name, type, input args) when constructing the ChaincodeInvocationSpec.","Use protoutil.CreateChaincodeSpec / SDK proposal builders so the spec is always set.","Log/inspect payload.GetInput() to verify the incoming proposal content before calling Evaluate.","Fix client code that sends a zero-value ChaincodeInvocationSpec."],"exampleFix":"// before\ninvocationSpec := &peer.ChaincodeInvocationSpec{} // nil ChaincodeSpec\n// after\ninvocationSpec := &peer.ChaincodeInvocationSpec{\n    ChaincodeSpec: &peer.ChaincodeSpec{\n        Type: peer.ChaincodeSpec_NODE,\n        ChaincodeId: &peer.ChaincodeID{Name: \"mycc\"},\n        Input: &peer.ChaincodeInput{Args: [][]byte{[]byte(\"query\")}},\n    },\n}","handlingStrategy":"validation","validationCode":"func validateChaincodeSpec(sp *peer.SignedProposal) error {\n    proposal, _ := protoutil.UnmarshalProposal(sp.GetProposalBytes())\n    payload, err := protoutil.UnmarshalPayload(proposal.GetPayload())\n    if err != nil {\n        return err\n    }\n    spec, err := protoutil.UnmarshalChaincodeInvocationSpec(payload.GetInput())\n    if err != nil {\n        return err\n    }\n    if spec.GetChaincodeSpec() == nil {\n        return errors.New(\"proposal invocation spec missing chaincode spec\")\n    }\n    return nil\n}","typeGuard":"func hasChaincodeSpec(spec *peer.ChaincodeInvocationSpec) bool {\n    return spec != nil && spec.GetChaincodeSpec() != nil\n}","tryCatchPattern":null,"preventionTips":["Never serialize a zero-value ChaincodeInvocationSpec; always fill ChaincodeSpec.","Use protoutil helpers (CreateChaincodeSpec, CreateChaincodeInvocationSpec) to build proposals.","Test proposal construction with a round-trip unmarshal before use.","Document required fields for any internal proposal-building utilities."],"tags":["validation","fabric-gateway","chaincode"],"backgroundTag":"missing-required-argument","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"}