{"record":{"id":"f4eec9627525387e","repo":"hyperledger/fabric","slug":"invalid-private-name-format-s","errorCode":null,"errorMessage":"invalid private name format: %s","messagePattern":"invalid private name format: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/lifecycle/lifecycle.go","lineNumber":683,"sourceCode":"\t\t}\n\t}\n\n\treturn &ApprovedChaincodeDefinition{\n\t\tSequence:        sequence,\n\t\tEndorsementInfo: ccParameters.EndorsementInfo,\n\t\tValidationInfo:  ccParameters.ValidationInfo,\n\t\tCollections:     ccParameters.Collections,\n\t\tSource:          ccsrc,\n\t}, nil\n}\n\nfunc extractChaincodeNameAndSequence(privateName string) (string, int64, error) {\n\tvar ccname string\n\tvar sequence int64\n\n\tsplit := strings.Split(privateName, \"#\")\n\tif len(split) != 2 {\n\t\treturn \"\", 0, errors.Errorf(\"invalid private name format: %s\", privateName)\n\t}\n\n\tccname = split[0]\n\tsequenceStr := split[1]\n\n\tvar err error\n\tsequence, err = strconv.ParseInt(sequenceStr, 10, 64)\n\tif err != nil {\n\t\treturn \"\", 0, errors.WithMessagef(err, \"invalid sequence number in private name: %s\", privateName)\n\t}\n\n\treturn ccname, sequence, nil\n}\n\n// ErrNamespaceNotDefined is the error returned when a namespace\n// is not defined. This indicates that the chaincode definition\n// has not been committed.\ntype ErrNamespaceNotDefined struct {","sourceCodeStart":665,"sourceCodeEnd":701,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/lifecycle/lifecycle.go#L665-L701","documentation":"extractChaincodeNameAndSequence expects the private metadata key to be exactly '<chaincodeName>#<sequence>'. If splitting on '#' does not yield exactly two parts, the key is malformed and this error is thrown. It indicates lifecycle state contains a key that does not conform to the naming convention.","triggerScenarios":"QueryApprovedChaincodeDefinitions iterates all keys under ChaincodeSourcesName in the org state and a key lacks the single '#' separator (zero or multiple '#'), or has an empty/non-numeric tail.","commonSituations":"Corrupt or manually edited peer state DB; keys written by an incompatible lifecycle implementation; leftover keys from state migration between Fabric versions.","solutions":["Locate the malformed key in the peer state DB (e.g. via couchdb views) and remove or fix it","Rebuild the peer state from channel snapshots or rejoin the peer to the channel","Ensure all peers run a supported Fabric version with a consistent lifecycle implementation","Restore from a known-good peer backup"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Validate expected key format before iterating state keys\nfunc isValidPrivateName(k string) bool {\n  parts := strings.Split(k, \"#\")\n  return len(parts) == 2 && parts[0] != \"\" && isInt(parts[1])\n}","typeGuard":null,"tryCatchPattern":"_, err := extractChaincodeNameAndSequence(key)\nif err != nil {\n  log.Warnf(\"skipping malformed lifecycle key %q: %v\", key, err)\n  continue\n}","preventionTips":["Do not insert custom keys into the lifecycle namespaces","Use supported Fabric versions only","Restore state only from compatible-version backups","Audit state DB after any manual restore"],"tags":["fabric","lifecycle","key-format","state-corruption"],"backgroundTag":"schema-validation-failed","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}