{"record":{"id":"587bad009ffd8a62","repo":"hyperledger/fabric","slug":"no-chaincode-id-is-provided-channel-id-s","errorCode":null,"errorMessage":"no chaincode id is provided, channel id [%s]","messagePattern":"no chaincode id is provided, channel id \\[(.+?)\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pkg/gateway/evaluate.go","lineNumber":147,"sourceCode":"\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}\n\n\treturn getResultFromProposalResponsePayload(responsePayload)\n}\n","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/pkg/gateway/evaluate.go#L129-L165","documentation":"Returned by getChannelAndChaincodeFromSignedProposal (internal/pkg/gateway/evaluate.go:147) when the ChaincodeSpec exists but its ChaincodeId is nil, meaning the proposal names no target chaincode. The gateway needs the chaincode ID to route the evaluation to the right contract.","triggerScenarios":"Evaluate called with a proposal where spec.ChaincodeSpec is set but ChaincodeId is nil — e.g. a ChaincodeSpec built with only Type/Input and no ChaincodeID.","commonSituations":"Manually constructing ChaincodeSpec and forgetting ChaincodeId; copying spec templates that leave the ID empty; proposals generated by older or mismatched client libraries with different field expectations.","solutions":["Set ChaincodeSpec.ChaincodeId = &peer.ChaincodeID{Name: \"mycc\"} when building the proposal.","Use SDK proposal builders that require and populate the chaincode name.","Validate the proposal client-side (chaincode name non-empty) before signing and submitting to Evaluate.","Confirm the chaincode name matches a deployed chaincode on the target channel."],"exampleFix":"// before\nchaincodeSpec := &peer.ChaincodeSpec{Type: peer.ChaincodeSpec_GOLANG} // no ChaincodeId\n// after\nchaincodeSpec := &peer.ChaincodeSpec{\n    Type: peer.ChaincodeSpec_GOLANG,\n    ChaincodeId: &peer.ChaincodeID{Name: \"mycc\"},\n}","handlingStrategy":"validation","validationCode":"func validateChaincodeId(spec *peer.ChaincodeSpec) error {\n    if spec.GetChaincodeId() == nil {\n        return errors.New(\"chaincode spec missing chaincode id\")\n    }\n    if spec.GetChaincodeId().GetName() == \"\" {\n        return errors.New(\"chaincode id missing name\")\n    }\n    return nil\n}","typeGuard":"func hasChaincodeId(spec *peer.ChaincodeSpec) bool {\n    return spec != nil && spec.GetChaincodeId() != nil && spec.GetChaincodeId().GetName() != \"\"\n}","tryCatchPattern":null,"preventionTips":["Always set ChaincodeID{Name} in the ChaincodeSpec.","Centralize proposal construction in one helper that enforces required fields.","Validate the chaincode name against deployed chaincodes on the channel.","Add pre-submit assertions in tests for ChaincodeId presence and non-empty name."],"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"}