hyperledger/fabric · error
no chaincode name is provided, channel id [%s]
Error message
no chaincode name is provided, channel id [%s]
What it means
This error comes from the gateway's getChannelAndChaincodeFromSignedProposal. After extracting the signed proposal payload, it checks that the proposal's ChaincodeSpec has a ChaincodeId with a non-empty Name. If the chaincode name is empty or missing, evaluation cannot proceed because the gateway would not know which chaincode to invoke, so it rejects the proposal with this message including the channel id.
Source
Thrown at internal/pkg/gateway/evaluate.go:151
spec, err := protoutil.UnmarshalChaincodeInvocationSpec(payload.GetInput())
if err != nil {
return "", "", false, err
}
if len(channelHeader.GetChannelId()) == 0 {
return "", "", false, fmt.Errorf("no channel id provided")
}
if spec.GetChaincodeSpec() == nil {
return "", "", false, fmt.Errorf("no chaincode spec is provided, channel id [%s]", channelHeader.GetChannelId())
}
if spec.GetChaincodeSpec().GetChaincodeId() == nil {
return "", "", false, fmt.Errorf("no chaincode id is provided, channel id [%s]", channelHeader.GetChannelId())
}
if len(spec.GetChaincodeSpec().GetChaincodeId().GetName()) == 0 {
return "", "", false, fmt.Errorf("no chaincode name is provided, channel id [%s]", channelHeader.GetChannelId())
}
return channelHeader.GetChannelId(), spec.GetChaincodeSpec().GetChaincodeId().GetName(), len(payload.TransientMap) > 0, nil
}
func getResultFromProposalResponse(proposalResponse *peer.ProposalResponse) ([]byte, error) {
responsePayload := &peer.ProposalResponsePayload{}
if err := proto.Unmarshal(proposalResponse.GetPayload(), responsePayload); err != nil {
return nil, errors.Wrap(err, "failed to deserialize proposal response payload")
}
return getResultFromProposalResponsePayload(responsePayload)
}
func getResultFromProposalResponsePayload(responsePayload *peer.ProposalResponsePayload) ([]byte, error) {
chaincodeAction := &peer.ChaincodeAction{}
if err := proto.Unmarshal(responsePayload.GetExtension(), chaincodeAction); err != nil {
return nil, errors.Wrap(err, "failed to deserialize chaincode action")View on GitHub (pinned to 2736b63f8f)
Solutions
- Set spec.chaincode_spec.chaincode_id.name to the instantiated chaincode name before signing/calling Evaluate
- Use a Fabric SDK (fabric-gateway, fabric-sdk-go/node/java) to build the proposal so chaincode id is populated automatically
- Inspect the signed proposal payload with protoc --decode=protos.ChaincodeProposalPayload to verify the ChaincodeId.Name field is present
Example fix
// before
spec := &peer.ChaincodeSpec{Input: &peer.ChaincodeInput{Args: args}}
// after
spec := &peer.ChaincodeSpec{
ChaincodeId: &peer.ChaincodeID{Name: "mycc"},
Input: &peer.ChaincodeInput{Args: args},
} Defensive patterns
Strategy: validation
Validate before calling
func validateProposal(spec *peer.ChaincodeSpec) error {
if spec.GetChaincodeId() == nil || len(spec.GetChaincodeId().GetName()) == 0 {
return fmt.Errorf("chaincode spec must include chaincode_id.name")
}
return nil
} Type guard
func hasChaincodeName(spec *peer.ChaincodeSpec) bool {
return spec != nil && spec.GetChaincodeId() != nil && spec.GetChaincodeId().GetName() != ""
} Prevention
- Always build proposals via an official Fabric SDK which sets ChaincodeId.Name
- Unit-test proposal construction to assert chaincode_id.name is non-empty before signing
- Never hand-assemble ChaincodeProposalPayload without validating ChaincodeSpec fields
When it happens
Trigger: Calling gateway Evaluate (or NewEvaluation of an endorsed proposal) with a signed proposal whose ChaincodeProposalPayload's ChaincodeSpec has ChaincodeId set to nil or ChaincodeId.Name empty — e.g. a proposal built manually without setting the chaincode name field.
Common situations: Hand-crafting a signed proposal with the protos instead of using a Fabric SDK; an SDK or tool version that serializes ChaincodeId differently (e.g. renamed to 'path' or left unset); copying proposal-building code that sets ChaincodeSpec.Input but forgets ChaincodeSpec.ChaincodeId.Name.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- only applicable for private data
- chaincode deployment spec cannot be nil in a package
- invalid type of envelope for chaincode package
- chaincode query must have at least one chaincode interest
- chaincode interest is nil
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/d72c6795709d10d2.
Report an issue: GitHub.