hyperledger/fabric · error

[%s] Fabric side handler cannot handle message (%s) while in

Error message

[%s] Fabric side handler cannot handle message (%s) while in created state

What it means

handleMessageCreatedState guard: the handler is still in Created state (chaincode not yet REGISTERed) but received a message other than REGISTER — typically a misbehaving or protocol-mismatched chaincode shim.

Source

Thrown at core/chaincode/handler.go:190

		return nil
	}

	switch state {
	case Created:
		return h.handleMessageCreatedState(msg)
	case Ready:
		return h.handleMessageReadyState(msg)
	default:
		return errors.Errorf("handle message: invalid state %s for transaction %s", state, msg.Txid)
	}
}

func (h *Handler) handleMessageCreatedState(msg *pb.ChaincodeMessage) error {
	switch msg.Type {
	case pb.ChaincodeMessage_REGISTER:
		h.HandleRegister(msg)
	default:
		return fmt.Errorf("[%s] Fabric side handler cannot handle message (%s) while in created state", msg.Txid, msg.Type)
	}
	return nil
}

func (h *Handler) handleMessageReadyState(msg *pb.ChaincodeMessage) error {
	switch msg.Type {
	case pb.ChaincodeMessage_COMPLETED, pb.ChaincodeMessage_ERROR:
		h.Notify(msg)

	case pb.ChaincodeMessage_PUT_STATE:
		go h.HandleTransaction(msg, h.HandlePutState)
	case pb.ChaincodeMessage_DEL_STATE:
		go h.HandleTransaction(msg, h.HandleDelState)
	case pb.ChaincodeMessage_INVOKE_CHAINCODE:
		go h.HandleTransaction(msg, h.HandleInvokeChaincode)
	case pb.ChaincodeMessage_GET_STATE:
		go h.HandleTransaction(msg, h.HandleGetState)
	case pb.ChaincodeMessage_GET_STATE_BY_RANGE:

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Ensure the chaincode shim sends REGISTER as its first message on the stream
  2. Align chaincode shim and peer Fabric versions and restart the chaincode
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at core/chaincode/handler.go:190 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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