{"record":{"id":"0667ac19fd001467","repo":"hyperledger/fabric","slug":"transaction-ids-not-maintained-in-index","errorCode":null,"errorMessage":"transaction IDs not maintained in index","messagePattern":"transaction IDs not maintained in index","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/ledger/blkstorage/blockindex.go","lineNumber":224,"sourceCode":"\t}\n\tblkFLP := &fileLocPointer{}\n\tif err = blkFLP.unmarshal(v.BlkLocation); err != nil {\n\t\treturn nil, err\n\t}\n\treturn blkFLP, nil\n}\n\nfunc (index *blockIndex) getTxValidationCodeByTxID(txID string) (peer.TxValidationCode, uint64, error) {\n\tv, blkNum, err := index.getTxIDVal(txID)\n\tif err != nil {\n\t\treturn peer.TxValidationCode(-1), 0, err\n\t}\n\treturn peer.TxValidationCode(v.TxValidationCode), blkNum, nil\n}\n\nfunc (index *blockIndex) txIDExists(txID string) (bool, error) {\n\tif !index.isAttributeIndexed(IndexableAttrTxID) {\n\t\treturn false, errors.New(\"transaction IDs not maintained in index\")\n\t}\n\trangeScan := constructTxIDRangeScan(txID)\n\titr, err := index.db.GetIterator(rangeScan.startKey, rangeScan.stopKey)\n\tif err != nil {\n\t\treturn false, errors.WithMessagef(err, \"error while trying to check the presence of TXID [%s]\", txID)\n\t}\n\tdefer itr.Release()\n\n\tpresent := itr.Next()\n\tif err := itr.Error(); err != nil {\n\t\treturn false, errors.Wrapf(err, \"error while trying to check the presence of TXID [%s]\", txID)\n\t}\n\treturn present, nil\n}\n\nfunc (index *blockIndex) getTxIDVal(txID string) (*TxIDIndexValue, uint64, error) {\n\tif !index.isAttributeIndexed(IndexableAttrTxID) {\n\t\treturn nil, 0, errors.New(\"transaction IDs not maintained in index\")","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/ledger/blkstorage/blockindex.go#L206-L242","documentation":"Returned by blockIndex.txIDExists when the TXID attribute is not enabled in the ledger's index configuration. It signals a configuration mismatch: the caller asks for tx-ID lookups the index was never built to serve.","triggerScenarios":"txIDExists invoked against a store whose indexAttrs exclude txid; unsupported-capability error raised immediately.","commonSituations":"Minimal index configurations, config copied from a txid-less deployment.","solutions":["Enable txid in index attrs and rebuild the index","Use default indexing config","Maintain txid bookkeeping outside the ledger if indexing stays disabled"],"exampleFix":"// before\nattrs: []blkstorage.IndexableAttr{blkstorage.IndexableAttrBlockNum}\n// after\nattrs: append(attrs, blkstorage.IndexableAttrTxID)","handlingStrategy":"validation","validationCode":"func ensureTxIDIndexed(cfg *blkstorage.IndexConfig) error {\n    for _, a := range cfg.Attrs {\n        if a == blkstorage.IndexableAttrTxID { return nil }\n    }\n    return errors.New(\"txid indexing disabled: TxIDExists unavailable\")\n}","typeGuard":"func txIDIndexed(attrs []blkstorage.IndexableAttr) bool {\n    for _, a := range attrs { if a == blkstorage.IndexableAttrTxID { return true } }\n    return false\n}","tryCatchPattern":"exists, err := store.TxIDExists(txid)\nif err != nil {\n    if strings.Contains(err.Error(), \"transaction IDs not maintained\") {\n        return fallbackLocalDupCheck(txid) // client-side/submitted-tx registry\n    }\n    return err\n}","preventionTips":["Never drop IndexableAttrTxID if txid queries are needed","Verify index config matches across all peer deployments","Rebuild index DB after enabling the txid attribute","Keep an application-level txid registry for dedup when indexing is minimized"],"tags":["hyperledger-fabric","blockchain","configuration","ledger-index"],"backgroundTag":"index-attribute-not-enabled","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"}