hyperledger/fabric · error
no chaincode id is provided, channel id [%s]
Error message
no chaincode id is provided, channel id [%s]
What it means
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.
Source
Thrown at internal/pkg/gateway/evaluate.go:147
payload, err := protoutil.UnmarshalChaincodeProposalPayload(proposal.GetPayload())
if err != nil {
return "", "", false, err
}
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)
}
View on GitHub (pinned to 2736b63f8f)
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.
Example fix
// before
chaincodeSpec := &peer.ChaincodeSpec{Type: peer.ChaincodeSpec_GOLANG} // no ChaincodeId
// after
chaincodeSpec := &peer.ChaincodeSpec{
Type: peer.ChaincodeSpec_GOLANG,
ChaincodeId: &peer.ChaincodeID{Name: "mycc"},
} Defensive patterns
Strategy: validation
Validate before calling
func validateChaincodeId(spec *peer.ChaincodeSpec) error {
if spec.GetChaincodeId() == nil {
return errors.New("chaincode spec missing chaincode id")
}
if spec.GetChaincodeId().GetName() == "" {
return errors.New("chaincode id missing name")
}
return nil
} Type guard
func hasChaincodeId(spec *peer.ChaincodeSpec) bool {
return spec != nil && spec.GetChaincodeId() != nil && spec.GetChaincodeId().GetName() != ""
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
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
- no chaincode spec is provided, channel id [%s]
- only applicable for private data
- did not find a code package inside the package
- illegal file name in payload: %s
- cannot collect files from empty chaincode path
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/587bad009ffd8a62.
Report an issue: GitHub.