NationalSecurityAgency/ghidra · error · IllegalStateException
More than one match
Error message
More than one match
What it means
Thrown (unchecked IllegalStateException) by findOneObject when table.findRecords returns more than one record for the given field value. findOneObject assumes the value is unique; multiple matches indicate a uniqueness violation (duplicates) or misuse of a find-one lookup on a non-unique column.
Source
Thrown at Ghidra/Debug/ProposedUtils/src/main/java/ghidra/util/database/DBCachedObjectStore.java:1188
}
/**
* Search a column index for a single object having the given value
*
* @param columnIndex the indexed column's number
* @param field a field holding the value to seek
* @return the object, if found, or null
* @throws IOException if there's an issue reading the table
* @throws IllegalStateException if the object is not unique
*/
protected T findOneObject(int columnIndex, Field field) throws IOException {
// TODO: Support non-long keys, eventually.
Field[] found = table.findRecords(field, columnIndex);
if (found.length == 0) {
return null;
}
if (found.length != 1) {
throw new IllegalStateException("More than one match");
}
return getObjectAt(found[0].getLongValue());
}
/**
* Search a column index for all objects having the given value
*
* @param columnIndex the indexed column's number
* @param field a field holding the value to seek
* @return the collection of objects found, possibly empty but never null
* @throws IOException if there's an issue reading the table
*/
protected DBCachedObjectStoreFoundKeysValueCollection<T> findObjects(int columnIndex,
Field field) throws IOException {
Field[] found = table.findRecords(field, columnIndex);
return new DBCachedObjectStoreFoundKeysValueCollection<>(this, adapter, lock, found);
}
View on GitHub (pinned to d5f144c24d)
Solutions
- If the column may legitimately have duplicates, use the multi-result find (findObjects) instead of findOneObject.
- Enforce uniqueness: declare a unique index / dedupe existing data so findOneObject's precondition holds.
- Audit the write path that populated duplicates and fix the upstream insertion logic.
- Run a cleanup pass to remove/merge duplicate rows before re-querying.
Example fix
// before
T obj = store.findOneObject(nameCol, field); // IllegalStateException on dupes
// after: query for all matches when uniqueness isn't guaranteed
Collection<T> matches = store.findObjects(nameCol, field);
if (matches.size() > 1) {
throw new IllegalStateException("expected unique, got " + matches.size());
}
T obj = matches.isEmpty() ? null : matches.iterator().next(); Defensive patterns
Strategy: validation
Validate before calling
// For columns that may have duplicates, query all matches
Collection<T> matches = store.findObjects(columnIndex, field);
if (matches.size() != 1) {
// not unique: dedupe, enforce a unique index, or handle multiple
} Try / catch
try {
T obj = store.findOneObject(columnIndex, field);
} catch (IllegalStateException e) {
if ("More than one match".equals(e.getMessage())) { /* use findObjects; dedupe */ }
else throw e;
} Prevention
- Use findObjects for columns that may have duplicate values.
- Enforce a unique index when findOneObject's uniqueness precondition is required.
- Audit insert paths that bypass uniqueness checks.
When it happens
Trigger: Querying a column that contains duplicate values via a method that assumes uniqueness; a unique index/constraint was not enforced so duplicate rows accumulated; data corruption or a write path that bypassed uniqueness checks.
Common situations: A 'unique key' column that lost its uniqueness guarantee; concurrent inserts creating duplicates; migrating legacy data with dupes into a store; using findOneObject on a column that was never intended to be unique.
Related errors
- {}
- Column {} is not indexed
- Column {} is not of type {}! It is {}
- Given field does not apply to given object type
- Given field does not have the given type: {} != {}
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/5206452d36ce4147.
Report an issue: GitHub.