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

  1. Set spec.chaincode_spec.chaincode_id.name to the instantiated chaincode name before signing/calling Evaluate
  2. Use a Fabric SDK (fabric-gateway, fabric-sdk-go/node/java) to build the proposal so chaincode id is populated automatically
  3. 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

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


AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04). Data as JSON: /api/errors/d72c6795709d10d2. Report an issue: GitHub.