canopy-network/canopy · error · ErrStoreGet

event not found

Error message

event not found

What it means

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.

Source

Thrown at store/indexer.go:733

	defer it.Close()
	for ; it.Valid(); it.Next() {
		tx, e := t.getEvent(it.Value())
		if e != nil {
			return nil, e
		}
		results = append(results, tx)
	}
	return
}

// getEvent() gets the event bytes from the DB and converts it into Event object
func (t *Indexer) getEvent(hashKey []byte) (*lib.Event, lib.ErrorI) {
	bz, err := t.db.Get(hashKey)
	if err != nil {
		return nil, err
	}
	if len(bz) == 0 {
		return nil, ErrStoreGet(errors.New("event not found"))
	}
	ptr := new(lib.Event)
	if err = lib.Unmarshal(bz, ptr); err != nil {
		return nil, err
	}
	return ptr, nil
}

// indexEventByHash() indexes an event by its hash
func (t *Indexer) indexEventByHash(e *lib.Event) (hashKey []byte, err lib.ErrorI) {
	bz, err := lib.Marshal(e)
	if err != nil {
		return nil, err
	}
	k := t.key(eventHashPrefix, crypto.Hash(bz), nil)
	return k, t.db.Set(k, bz)
}

View on GitHub (pinned to ee8197d91d)

Solutions

  1. Confirm the event hash corresponds to a finalized, indexed transaction on this node
  2. Wait for indexing to catch up if the transaction is recent
  3. Treat as a not-found condition and surface a friendly message to the caller/user

Example fix

// before
ev, err := idx.GetEvent(hash) // assume exists
// after
ev, err := idx.GetEvent(hash)
if err != nil && strings.Contains(err.Error(), "event not found") {
	return nil, fmt.Errorf("event %x not indexed on this node", hash)
}
Defensive patterns

Strategy: try-catch

Validate before calling

if len(eventHash) == 0 { return errors.New("event hash required") }
// optionally verify the tx/event is finalized before lookup

Try / catch

ev, errI := idx.GetEvent(hash)
if errI != nil {
	if strings.Contains(errI.Error(), "event not found") {
		return nil, ErrNotFound // map to 404-style handling
	}
	return nil, errI
}

Prevention

When it happens

Trigger: Event lookups (via getEventsNonPaginated or handler code) with a hash that was never indexed, was pruned, or is malformed.

Common situations: Querying an event from a rejected or not-yet-finalized transaction; querying after indexer pruning; a client hash from a different chain/instance.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of canopy-network/canopy@ee8197d91d (2026-09-06). Data as JSON: /api/errors/47c13aecd80332d2. Report an issue: GitHub.