hyperledger/fabric · error

failed initializing plugin

Error message

failed initializing plugin

What it means

A validation plugin was found and instantiated, but its Init() call failed when given the policy evaluator, state fetcher, capabilities, and collection-info provider. The underlying plugin error is wrapped with this message and validation aborts.

Source

Thrown at core/committer/txvalidator/v14/plugin_validator.go:184

	plugin, exists = pbc.channels2Plugins[channel]
	if exists {
		return plugin, nil
	}

	pluginInstance := pbc.pluginFactory.New()
	plugin, err := pbc.initPlugin(pluginInstance, channel)
	if err != nil {
		return nil, err
	}
	pbc.channels2Plugins[channel] = plugin
	return plugin, nil
}

func (pbc *pluginsByChannel) initPlugin(plugin validation.Plugin, channel string) (validation.Plugin, error) {
	pe := &PolicyEvaluator{IdentityDeserializer: pbc.pv.IdentityDeserializer}
	sf := &StateFetcherImpl{QueryExecutorCreator: pbc.pv}
	if err := plugin.Init(pe, sf, pbc.pv.capabilities, &legacyCollectionInfoProvider{}); err != nil {
		return nil, errors.Wrap(err, "failed initializing plugin")
	}
	return plugin, nil
}

// legacyCollectionInfoProvider implements a provider for collection
// information for the legacy lifecycle. It will never be called but
// it is necessary to have this dependency passed at init time to the
// default plugin
type legacyCollectionInfoProvider struct{}

func (*legacyCollectionInfoProvider) CollectionValidationInfo(chaincodeName, collectionName string, state vs.State) ([]byte, error, error) {
	panic("programming error")
}

type PolicyEvaluator struct {
	msp.IdentityDeserializer
}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Check peer logs for the wrapped inner error from plugin.Init
  2. Rebuild the plugin against the exact Fabric version of the peer
  3. Verify the plugin's Init implementation handles the provided PolicyEvaluator/StateFetcher correctly
  4. Remove or correct the plugin in core.yaml handlers and fall back to the default vscc

Example fix

// before: plugin built against Fabric 1.4 API used on 2.x peer
// after
go mod edit -require github.com/hyperledger/fabric@v2.5.0 && go build -o myvscc.so
Defensive patterns

Strategy: try-catch

Validate before calling

// compile-time check that the plugin implements the current interface
var _ validation.Plugin = (*MyPlugin)(nil)
// and smoke-test Init in a unit test before shipping

Type guard

var _ validation.Plugin = (*MyPlugin)(nil)

Try / catch

plugin, err := pv.getOrCreatePlugin(ctx)
if err != nil && strings.Contains(err.Error(), "failed initializing plugin") {
    // fall back to default vscc or abort channel validation with clear log
}

Prevention

When it happens

Trigger: plugin.Init(pe, sf, capabilities, collectionInfoProvider) returns an error during createPluginIfAbsent, e.g., the plugin rejects the provided dependencies or fails internal initialization.

Common situations: Custom VSCC plugin that requires state it cannot fetch or mismatches the Fabric plugin API version; plugin compiled against a different validation.Plugin interface (Fabric version mismatch); plugin panics/errors on capabilities it doesn't support.

Related errors


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