hyperledger/fabric · error

application config does not exist for %s

Error message

application config does not exist for %s

What it means

checkMetadataCap validates that the given channel has an application config and that key-level endorsement is enabled before serving GetStateMetadata or PutStateMetadata. This error is returned when the peer cannot find an application configuration for channelId — typically the channel doesn't exist on this peer, the channel id is wrong, or the channel is not yet fully configured/joined.

Source

Thrown at core/chaincode/handler.go:611

	return txContext, nil
}

// register Txid to prevent overlapping handle messages from chaincode
func (h *Handler) registerTxid(msg *pb.ChaincodeMessage) bool {
	// Check if this is the unique state request from this chaincode txid
	if h.ActiveTransactions.Add(msg.ChannelId, msg.Txid) {
		return true
	}

	// Log the issue and drop the request
	chaincodeLogger.Errorf("[%s] Another request pending for this CC: %s, Txid: %s, ChannelID: %s. Cannot process.", shorttxid(msg.Txid), h.chaincodeID, msg.Txid, msg.ChannelId)
	return false
}

func (h *Handler) checkMetadataCap(channelId string) error {
	ac, exists := h.AppConfig.GetApplicationConfig(channelId)
	if !exists {
		return errors.Errorf("application config does not exist for %s", channelId)
	}

	if !ac.Capabilities().KeyLevelEndorsement() {
		return errors.New("key level endorsement is not enabled, channel application capability of V1_3 or later is required")
	}
	return nil
}

func (h *Handler) checkPurgePrivateDataCap(channelId string) error {
	ac, exists := h.AppConfig.GetApplicationConfig(channelId)
	if !exists {
		return errors.Errorf("application config does not exist for %s", channelId)
	}

	if !ac.Capabilities().PurgePvtData() {
		return errors.New("purge private data is not enabled, channel application capability of V2_5 or later is required")
	}
	return nil

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Verify the channel id passed to the metadata API exactly matches a channel the peer has joined (peer channel list)
  2. Join the peer to the channel and wait for the channel config/gossip to initialize before calling metadata APIs
  3. Check that the chaincode is instantiated on the intended channel, not another one
  4. Inspect peer logs for channel config load errors
Defensive patterns

Strategy: validation

Validate before calling

// before calling GetStateMetadata/SetStateMetadata:
// ensure channel exists & joined
// $ peer channel list  -> confirm channelId present
if !joinedChannels.Contains(channelId) {
    return fmt.Errorf("channel %s not joined on this peer", channelId)
}

Prevention

When it happens

Trigger: Chaincode sends GET_STATE_METADATA or PUT_STATE_METADATA for a channelId where h.AppConfig.GetApplicationConfig returns exists=false: chaincode joined to the wrong channel, typo'd channel name, channel not yet joined/initialized on the peer, or metadata API called before the channel config is loaded.

Common situations: Developers calling SetStateMetadata/GetStateMetadata against a channel the peer hasn't joined; deploying the same chaincode instance expecting multiple channels; channel creation still propagating; misspelled channel name in tooling.

Related errors


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