hyperledger/fabric · error

target block number [%d] should be less than the biggest blo

Error message

target block number [%d] should be less than the biggest block number [%d]

What it means

Returned by validateTargetBlkNum when the requested rollback target block number is >= the last persisted block. A rollback must remove at least one block, so a target at or beyond the current height is rejected as a no-op/invalid request.

Source

Thrown at common/ledger/blkstorage/rollback.go:267

	logger.Debugf("Validating the existence of ledgerID [%s]", ledgerID)
	exists, err := fileutil.DirExists(ledgerDir)
	if err != nil {
		return err
	}
	if !exists {
		return errors.Errorf("ledgerID [%s] does not exist", ledgerID)
	}
	return nil
}

func validateTargetBlkNum(ledgerDir string, targetBlockNum uint64) error {
	logger.Debugf("Validating the given block number [%d] against the ledger block height", targetBlockNum)
	blkfilesInfo, err := constructBlockfilesInfo(ledgerDir)
	if err != nil {
		return err
	}
	if blkfilesInfo.lastPersistedBlock <= targetBlockNum {
		return errors.Errorf("target block number [%d] should be less than the biggest block number [%d]",
			targetBlockNum, blkfilesInfo.lastPersistedBlock)
	}
	return nil
}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Choose a target block number strictly less than the current last persisted block
  2. Check current block height and rerun rollback with a valid target
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at common/ledger/blkstorage/rollback.go:267 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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