hyperledger/fabric · error

unknown collection configuration type

Error message

unknown collection configuration type

What it means

Each entry in a committed collection config package is expected to be a CollectionConfig containing a StaticCollectionConfig. This error is thrown when GetStaticCollectionConfig() returns nil, meaning the committed package holds an unknown collection configuration type that cannot be interpreted.

Source

Thrown at core/chaincode/lifecycle/scc.go:943

		return nil
	}

	if len(proposedCollConfs) == 0 {
		return errors.Errorf("the proposed collection config does not contain previously defined collections")
	}

	proposedCollsMap := map[string]*pb.StaticCollectionConfig{}
	for _, c := range proposedCollConfs {
		proposedCollsMap[c.Name] = c
	}

	// In the new collection config package, ensure that there is one entry per old collection. Any
	// number of new collections are allowed.
	for _, committedCollConfig := range committedCollConfPkg.Config {
		committedColl := committedCollConfig.GetStaticCollectionConfig()
		// It cannot be nil
		if committedColl == nil {
			return errors.Errorf("unknown collection configuration type")
		}

		newCollection, ok := proposedCollsMap[committedColl.Name]
		if !ok {
			return errors.Errorf("existing collection [%s] missing in the proposed collection configuration", committedColl.Name)
		}

		if newCollection.BlockToLive != committedColl.BlockToLive {
			return errors.Errorf("the BlockToLive in an existing collection [%s] modified. Existing value [%d]", committedColl.Name, committedColl.BlockToLive)
		}
	}
	return nil
}

func (i *Invocation) createOpaqueStates() ([]OpaqueState, error) {
	if i.ApplicationConfig == nil {
		return nil, errors.Errorf("no application config for channel '%s'", i.Stub.GetChannelID())
	}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Regenerate and re-commit the chaincode definition with a valid collection config package where each entry has a StaticCollectionConfig.
  2. Inspect the committed package bytes on state to find the malformed entry.
  3. Avoid hand-building CollectionConfig wrappers; ensure CollectionType/static_collection_config is set.
  4. Upgrade tooling/fabric so collection packages are serialized in a compatible format.

Example fix

// before: empty wrapper
conf := &pb.CollectionConfig{}
// after
conf := &pb.CollectionConfig{Payload: &pb.CollectionConfig_StaticCollectionConfig{StaticCollectionConfig: &pb.StaticCollectionConfig{Name: "coll1"}}}
Defensive patterns

Strategy: type-guard

Validate before calling

for _, cc := range committedPkg.Config {
  if cc.GetStaticCollectionConfig() == nil {
    return fmt.Errorf("committed package contains non-static collection config")
  }
}

Type guard

func validCommittedEntry(cc *pb.CollectionConfig) (*pb.StaticCollectionConfig, bool) {
  sc := cc.GetStaticCollectionConfig()
  return sc, sc != nil && sc.Name != ""
}

Try / catch

if err := commit(...); err != nil {
  if strings.Contains(err.Error(), "unknown collection configuration type") {
    // inspect committed state; rebuild the collection config package with StaticCollectionConfig set
  }
  return err
}

Prevention

When it happens

Trigger: Validating a proposed collection config against committed data where a committed CollectionConfig entry has no StaticCollectionConfig oneof value set (nil/empty or unknown type in the oneof).

Common situations: Corrupted or hand-crafted collection config package persisted to state; protobuf oneof field left unset when building the committed package; data written by incompatible fabric versions or custom tooling.

Related errors


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