hyperledger/fabric · error

application config does not exist for channel '%s'

Error message

application config does not exist for channel '%s'

What it means

Cache.ChaincodeInfo in core/chaincode/lifecycle/cache.go throws this when querying the _lifecycle system chaincode and the channel's stable channel config has no Application config. In Fabric, a channel config might lack an Application group (e.g. ordering-only config). The cache cannot resolve _lifecycle info without application-level settings (capabilities, orgs).

Source

Thrown at core/chaincode/lifecycle/cache.go:343

	// NOTE: It's extremely tempting to acquire the write lock in HandleStateUpdate
	// and release it here, however, this is asking for a deadlock.  In particular,
	// because the 'write lock' on the state is only held for a short period
	// between HandleStateUpdate and StateCommitDone, it's possible (in fact likely)
	// that a chaincode invocation will acquire a read-lock on the world state, then attempt
	// to get chaincode info from the cache, resulting in a deadlock.  So, we choose
	// potential inconsistency between the cache and the world state which the callers
	// must detect and cope with as necessary.  Note, the cache will always be _at least_
	// as current as the committed state.
	c.eventBroker.ApproveOrDefineCommitted(channelName)
}

// ChaincodeInfo returns the chaincode definition and its install info.
// An error is returned only if either the channel or the chaincode do not exist.
func (c *Cache) ChaincodeInfo(channelID, name string) (*LocalChaincodeInfo, error) {
	if name == LifecycleNamespace {
		ac, ok := c.Resources.ChannelConfigSource.GetStableChannelConfig(channelID).ApplicationConfig()
		if !ok {
			return nil, errors.Errorf("application config does not exist for channel '%s'", channelID)
		}
		if !ac.Capabilities().LifecycleV20() {
			return nil, errors.Errorf("cannot use _lifecycle without V2_0 application capabilities enabled for channel '%s'", channelID)
		}
		return c.getLifecycleSCCChaincodeInfo(channelID)
	}

	c.mutex.RLock()
	defer c.mutex.RUnlock()
	channelChaincodes, ok := c.definedChaincodes[channelID]
	if !ok {
		return nil, errors.Errorf("unknown channel '%s'", channelID)
	}

	cachedChaincode, ok := channelChaincodes.Chaincodes[name]
	if !ok {
		return nil, errors.Errorf("unknown chaincode '%s' for channel '%s'", name, channelID)
	}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Verify the channel's config contains an Application group (falsify via 'configtxlator' or inspect the channel config block).
  2. Re-add the Application section via a config update transaction with proper org signatures.
  3. Confirm the channelID is correct and the peer has joined the intended channel.
  4. Check ApplicationConfigSource wiring on the peer so stable channel config exposes ApplicationConfig.

Example fix

// before: query with possibly missing app config
info, err := cache.ChaincodeInfo("mychannel", "_lifecycle")
// after: guard first
cc, ok := configSource.GetStableChannelConfig("mychannel").ApplicationConfig()
if !ok { return nil, fmt.Errorf("channel %s has no application config; fix channel config before using _lifecycle", "mychannel") }
info, err := cache.ChaincodeInfo("mychannel", "_lifecycle")
Defensive patterns

Strategy: validation

Validate before calling

if _, ok := configSource.GetStableChannelConfig(channelID).ApplicationConfig(); !ok {
    return fmt.Errorf("channel %s has no application config; cannot query _lifecycle", channelID)
}

Try / catch

info, err := cache.ChaincodeInfo(channelID, "_lifecycle")
if err != nil {
    if strings.Contains(err.Error(), "application config does not exist") {
        return nil, errAppConfigMissing // typed sentinel
    }
    return nil, err
}

Prevention

When it happens

Trigger: Calling ChaincodeInfo(channelID, "_lifecycle") when ChannelConfigSource.GetStableChannelConfig(channelID).ApplicationConfig() returns ok=false, i.e. the channel config has no Application group.

Common situations: Channel config edited or created without an Application section; querying a channel served mostly by orderers; a config update removed application config; wrong channel ID resolving to a malformed config.

Related errors


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