{"record":{"id":"aeb7d7c79f590b13","repo":"hyperledger/fabric","slug":"no-records-were-read-json-record-list-is-either-e","errorCode":null,"errorMessage":"no records were read. JSON record list is either empty or not properly formatted. Aborting identifytxs","messagePattern":"no records were read\\. JSON record list is either empty or not properly formatted\\. Aborting identifytxs","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/ledgerutil/identifytxs/identifytxs.go","lineNumber":48,"sourceCode":"\tledgersDataDirName = \"ledgersData\"\n\tnsJoiner           = \"$$\"\n\tpvtDataPrefix      = \"p\"\n\thashDataPrefix     = \"h\"\n)\n\n// IdentifyTxs - IdentifyTxs identifies all transactions related to a list of records (namespace / key pairs)\n// Tool was originally created to map list of divergent records from ledgerutil compare output to their respective transactions\n// to identify list of transactions that have potentially caused divergent state\n// Returns two block numbers that represent the starting and ending blocks of the transaction search range\nfunc IdentifyTxs(recPath string, fsPath string, outputDirLoc string) (uint64, uint64, error) {\n\t// Read diffRecord list from json\n\tvar records *models.DiffRecordList\n\trecords, err := jsonrw.LoadRecords(recPath)\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\tif len(records.DiffRecords) == 0 {\n\t\treturn 0, 0, errors.Errorf(\"no records were read. JSON record list is either empty or not properly formatted. Aborting identifytxs\")\n\t}\n\n\t// Output directory creation\n\toutputDirName := fmt.Sprintf(\"%s_identified_transactions\", records.Ledgerid)\n\toutputDirPath := filepath.Join(outputDirLoc, outputDirName)\n\n\tempty, err := fileutil.CreateDirIfMissing(outputDirPath)\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\tif !empty {\n\t\treturn 0, 0, errors.Errorf(\"%s already exists in %s. Choose a different location or remove the existing results. Aborting identifytxs\", outputDirName, outputDirLoc)\n\t}\n\n\t// Get recordsMap from json\n\tinputKeyMapWrapper, err := generateRecordsMap(records.DiffRecords, outputDirPath)\n\tif err != nil {\n\t\treturn 0, 0, err","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/ledgerutil/identifytxs/identifytxs.go#L30-L66","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\n{ \"ledgerid\": \"myledger\", \"diffRecords\": [] }\n// after\n{ \"ledgerid\": \"myledger\", \"diffRecords\": [ { \"namespace\": \"ns\", \"key\": \"k1\", \"records\": [...] } ] }","handlingStrategy":"validation","validationCode":"// Go: verify the diff JSON has records before calling IdentifyTxs\ndata, _ := os.ReadFile(recPath)\nvar probe struct{ DiffRecords []json.RawMessage `json:\"diffRecords\"` }\nif json.Unmarshal(data, &probe) != nil || len(probe.DiffRecords) == 0 {\n    return errors.New(\"diff record JSON is empty or malformed\")\n}","typeGuard":null,"tryCatchPattern":"if _, _, err := ledgerutil.IdentifyTxs(recPath, outDir); err != nil {\n    if strings.Contains(err.Error(), \"no records were read\") {\n        return fmt.Errorf(\"check the input JSON produced by ledgerutil compare: %w\", err)\n    }\n    return err\n}","preventionTips":["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"],"tags":["hyperledger-fabric","ledgerutil","json-input","empty-input"],"backgroundTag":"empty-json-input","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"}