{"record":{"id":"9e185f01d09c363e","repo":"hyperledger/fabric","slug":"attempted-to-redefine-the-current-committed-sequen","errorCode":null,"errorMessage":"attempted to redefine the current committed sequence (%d) for namespace %s","messagePattern":"attempted to redefine the current committed sequence \\((.+?)\\) for namespace (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"core/chaincode/lifecycle/lifecycle.go","lineNumber":474,"sourceCode":"\n\t\tdefinedChaincode := &ChaincodeDefinition{}\n\t\tif err := ef.Resources.Serializer.Deserialize(NamespacesName, ccname, metadata, definedChaincode, publicState); err != nil {\n\t\t\treturn errors.WithMessagef(err, \"could not deserialize namespace %s as chaincode\", ccname)\n\t\t}\n\n\t\tif err := definedChaincode.Parameters().Equal(cd.Parameters()); err != nil {\n\t\t\treturn errors.WithMessagef(err, \"attempted to redefine the current committed sequence (%d) for namespace %s with different parameters\", currentSequence, ccname)\n\t\t}\n\t\t// it might be the case that some organization just installed\n\t\t// the chaincode and now would like to approve, therefore we\n\t\t// need to check to distinguish the case. hence need to read from\n\t\t// the orgState metadata and see whenever this is the case\n\t\tredefine, err := ef.isAttemptToRedefine(privateName, packageID, requestedSequence, cd, orgState)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif redefine {\n\t\t\treturn errors.Errorf(\"attempted to redefine the current committed sequence (%d) for namespace %s\", currentSequence, ccname)\n\t\t}\n\t}\n\n\t// if requested sequence is not committed, and attempt is made to update its content,\n\t// we need to check whether new definition actually contains updated content, to avoid\n\t// empty write set.\n\tif requestedSequence == currentSequence+1 {\n\t\tredefine, err := ef.isAttemptToRedefine(privateName, packageID, requestedSequence, cd, orgState)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif redefine {\n\t\t\treturn errors.Errorf(\"attempted to redefine uncommitted sequence (%d) for namespace %s with unchanged content\", requestedSequence, ccname)\n\t\t}\n\t}\n\n\tif err := ef.Resources.Serializer.Serialize(NamespacesName, privateName, cd.Parameters(), orgState); err != nil {\n\t\treturn errors.WithMessage(err, \"could not serialize chaincode parameters to state\")","sourceCodeStart":456,"sourceCodeEnd":492,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/lifecycle/lifecycle.go#L456-L492","documentation":"The org attempted to approve a definition whose sequence equals the currently committed sequence, and the content is identical to what is already committed (isAttemptToRedefine detected no change). Re-approving the same committed definition unchanged would produce an empty write set, so lifecycle rejects it.","triggerScenarios":"Re-running 'peer lifecycle chaincode approveformyorg' with the same sequence and identical package/parameters as already committed for the org.","commonSituations":"Idempotent CI re-runs; operators re-running a deployment script end-to-end after a partial failure elsewhere in the flow; accidental double-execution of approve commands.","solutions":["Skip the approval — check 'peer lifecycle chaincode checkcommitreadiness' to confirm the org already approved","If a change is intended, increment the sequence by 1 and change the definition (package ID, parameters, or policy)","Make deployment scripts idempotent by comparing committed state before approving"],"exampleFix":"// before\napprove(seq=currentSequence, samePackageID) // rejected as redefine\n// after\nif !alreadyApproved(org, cc, currentSequence) { approve(currentSequence, packageID) } else { proceed to commit }","handlingStrategy":"validation","validationCode":"// Skip approval if org already approved identical definition at this sequence\nreadiness := checkCommitReadiness(ch, ccname, def) // returns org approvals\nif readiness[myOrg] == true {\n    return nil // already approved; go straight to commit\n}","typeGuard":null,"tryCatchPattern":"err := ef.ApproveChaincodeDefinitionForOrg(...)\nif err != nil && strings.Contains(err.Error(), \"attempted to redefine the current committed sequence\") {\n    // treat as success: definition already committed and approved\n    return nil\n}","preventionTips":["Run checkcommitreadiness before every approve call","Make deployment pipelines idempotent: detect prior approvals and skip","Only re-approve when the definition content genuinely changes"],"tags":["fabric","lifecycle","idempotency"],"backgroundTag":"duplicate-approval","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"}