{"record":{"id":"47c13aecd80332d2","repo":"canopy-network/canopy","slug":"event-not-found","errorCode":null,"errorMessage":"event not found","messagePattern":"event not found","errorType":"error_code","errorClass":"ErrStoreGet","httpStatus":null,"severity":"error","filePath":"store/indexer.go","lineNumber":733,"sourceCode":"\tdefer it.Close()\n\tfor ; it.Valid(); it.Next() {\n\t\ttx, e := t.getEvent(it.Value())\n\t\tif e != nil {\n\t\t\treturn nil, e\n\t\t}\n\t\tresults = append(results, tx)\n\t}\n\treturn\n}\n\n// getEvent() gets the event bytes from the DB and converts it into Event object\nfunc (t *Indexer) getEvent(hashKey []byte) (*lib.Event, lib.ErrorI) {\n\tbz, err := t.db.Get(hashKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(bz) == 0 {\n\t\treturn nil, ErrStoreGet(errors.New(\"event not found\"))\n\t}\n\tptr := new(lib.Event)\n\tif err = lib.Unmarshal(bz, ptr); err != nil {\n\t\treturn nil, err\n\t}\n\treturn ptr, nil\n}\n\n// indexEventByHash() indexes an event by its hash\nfunc (t *Indexer) indexEventByHash(e *lib.Event) (hashKey []byte, err lib.ErrorI) {\n\tbz, err := lib.Marshal(e)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tk := t.key(eventHashPrefix, crypto.Hash(bz), nil)\n\treturn k, t.db.Set(k, bz)\n}\n","sourceCodeStart":715,"sourceCodeEnd":751,"githubUrl":"https://github.com/canopy-network/canopy/blob/ee8197d91dd410f6592cb650a94c925ee6dc8bad/store/indexer.go#L715-L751","documentation":"Raised in Indexer.getEvent (store/indexer.go:733) when the DB lookup for an event hash returns zero bytes — the key exists mapping to nothing or the hash was never indexed. Wrapped via ErrStoreGet, it signals callers of GetEventByHash/iteration that no event corresponds to the given hash rather than a storage I/O failure.","triggerScenarios":"Event lookups (via getEventsNonPaginated or handler code) with a hash that was never indexed, was pruned, or is malformed.","commonSituations":"Querying an event from a rejected or not-yet-finalized transaction; querying after indexer pruning; a client hash from a different chain/instance.","solutions":["Confirm the event hash corresponds to a finalized, indexed transaction on this node","Wait for indexing to catch up if the transaction is recent","Treat as a not-found condition and surface a friendly message to the caller/user"],"exampleFix":"// before\nev, err := idx.GetEvent(hash) // assume exists\n// after\nev, err := idx.GetEvent(hash)\nif err != nil && strings.Contains(err.Error(), \"event not found\") {\n\treturn nil, fmt.Errorf(\"event %x not indexed on this node\", hash)\n}","handlingStrategy":"try-catch","validationCode":"if len(eventHash) == 0 { return errors.New(\"event hash required\") }\n// optionally verify the tx/event is finalized before lookup","typeGuard":null,"tryCatchPattern":"ev, errI := idx.GetEvent(hash)\nif errI != nil {\n\tif strings.Contains(errI.Error(), \"event not found\") {\n\t\treturn nil, ErrNotFound // map to 404-style handling\n\t}\n\treturn nil, errI\n}","preventionTips":["Only query events after their transaction is finalized","Handle pruning/retention windows when querying old events","Confirm hashes come from the same chain instance"],"tags":["store","indexer","not-found"],"backgroundTag":"record-not-found","analyzedSha":"ee8197d91dd410f6592cb650a94c925ee6dc8bad","analyzedAt":"2026-09-06T09:30:15.973Z","contentChangedAt":"2026-09-06T09:30:15.973Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}