hyperledger/fabric · error
no records were read. JSON record list is either empty or no
Error message
no records were read. JSON record list is either empty or not properly formatted. Aborting identifytxs
What it means
IdentifyTxs reads a diff record list JSON (produced by the ledger compare utility) to identify transactions touching divergent keys. If the JSON loaded successfully but contains zero diff records, there is nothing to process and this error aborts the run.
Source
Thrown at internal/ledgerutil/identifytxs/identifytxs.go:48
ledgersDataDirName = "ledgersData"
nsJoiner = "$$"
pvtDataPrefix = "p"
hashDataPrefix = "h"
)
// IdentifyTxs - IdentifyTxs identifies all transactions related to a list of records (namespace / key pairs)
// Tool was originally created to map list of divergent records from ledgerutil compare output to their respective transactions
// to identify list of transactions that have potentially caused divergent state
// Returns two block numbers that represent the starting and ending blocks of the transaction search range
func IdentifyTxs(recPath string, fsPath string, outputDirLoc string) (uint64, uint64, error) {
// Read diffRecord list from json
var records *models.DiffRecordList
records, err := jsonrw.LoadRecords(recPath)
if err != nil {
return 0, 0, err
}
if len(records.DiffRecords) == 0 {
return 0, 0, errors.Errorf("no records were read. JSON record list is either empty or not properly formatted. Aborting identifytxs")
}
// Output directory creation
outputDirName := fmt.Sprintf("%s_identified_transactions", records.Ledgerid)
outputDirPath := filepath.Join(outputDirLoc, outputDirName)
empty, err := fileutil.CreateDirIfMissing(outputDirPath)
if err != nil {
return 0, 0, err
}
if !empty {
return 0, 0, errors.Errorf("%s already exists in %s. Choose a different location or remove the existing results. Aborting identifytxs", outputDirName, outputDirLoc)
}
// Get recordsMap from json
inputKeyMapWrapper, err := generateRecordsMap(records.DiffRecords, outputDirPath)
if err != nil {
return 0, 0, errView on GitHub (pinned to 2736b63f8f)
Solutions
- Check the input JSON has a non-empty records array (e.g. {"diffRecords":[...]}) under the given path
- Re-run ledgerutil compare to regenerate a valid diff record list if the source file is empty
- Verify the correct file path was passed as the recPath argument
Example fix
// before
{ "ledgerid": "myledger", "diffRecords": [] }
// after
{ "ledgerid": "myledger", "diffRecords": [ { "namespace": "ns", "key": "k1", "records": [...] } ] } Defensive patterns
Strategy: validation
Validate before calling
// Go: verify the diff JSON has records before calling IdentifyTxs
data, _ := os.ReadFile(recPath)
var probe struct{ DiffRecords []json.RawMessage `json:"diffRecords"` }
if json.Unmarshal(data, &probe) != nil || len(probe.DiffRecords) == 0 {
return errors.New("diff record JSON is empty or malformed")
} Try / catch
if _, _, err := ledgerutil.IdentifyTxs(recPath, outDir); err != nil {
if strings.Contains(err.Error(), "no records were read") {
return fmt.Errorf("check the input JSON produced by ledgerutil compare: %w", err)
}
return err
} Prevention
- Confirm ledgerutil compare produced a non-empty diff list before running identifytxs
- Validate the JSON structure (diffRecords array with entries) before invoking
- Pass the exact compare output path, not a directory or unrelated file
When it happens
Trigger: Running ledgerutil identifytxs with a JSON file that is empty, an empty diff-records array, or a file whose structure doesn't match DiffRecordList (so records parsed as empty).
Common situations: Pointing the tool at the wrong or truncated output of ledgerutil compare; compare found no divergences but identifytxs was still run; hand-edited JSON removed records.
Related errors
- invalid input json. Each record entry must contain both a "n
- invalid input json. Contains duplicate record for {"namespa
- %s already exists in %s. Choose a different location or remo
- BlockStore for %s does not exist. Aborting identifytxs
- malformed org definition for org: %s
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/aeb7d7c79f590b13.
Report an issue: GitHub.