NationalSecurityAgency/ghidra · error · IllegalArgumentException
Column {} is not indexed
Error message
Column {} is not indexed What it means
Thrown (unchecked IllegalArgumentException) by DBCachedObjectStore.getIndex(fieldClass, columnIndex) when the column at columnIndex is not among the table's indexed columns (table.getIndexedColumns()). An index must be declared when the store/table is created; requesting one on a non-indexed column is rejected because no backing DB index exists.
Source
Thrown at Ghidra/Debug/ProposedUtils/src/main/java/ghidra/util/database/DBCachedObjectStore.java:998
int index = ArrayUtils.indexOf(schema.getFieldNames(), name);
if (index < 0) {
throw new NoSuchElementException(name);
}
return index;
}
/**
* Get the table index for the given column number
*
* @param <K> the type of the object field for the indexed column
* @param fieldClass the class specifying {@link K}
* @param columnIndex the column number
* @return the index
* @throws IllegalArgumentException if the column has a different type than {@link K}
*/
protected <K> DBCachedObjectIndex<K, T> getIndex(Class<K> fieldClass, int columnIndex) {
if (!ArrayUtils.contains(table.getIndexedColumns(), columnIndex)) {
throw new IllegalArgumentException(
"Column " + schema.getFieldNames()[columnIndex] + " is not indexed");
}
DBFieldCodec<?, T, ?> codec = codecs.get(columnIndex);
Class<?> exp = codec.getValueType();
if (fieldClass != exp) {
throw new IllegalArgumentException("Column " + schema.getFieldNames()[columnIndex] +
" is not of type " + fieldClass + "! It is " + exp);
}
@SuppressWarnings("unchecked")
DBFieldCodec<K, T, ?> castCodec = (DBFieldCodec<K, T, ?>) codec;
return new DBCachedObjectIndex<>(this, adapter, castCodec, columnIndex, FieldSpan.ALL,
Direction.FORWARD);
}
/**
* Get the index for a given column
* View on GitHub (pinned to d5f144c24d)
Solutions
- Declare the column as indexed in the store factory / annotated schema so the table builds a backing index for it.
- If you only need a scan, use a non-indexed find (scan) instead of getIndex-based lookup.
- Confirm columnIndex maps to the intended column via schema.getFieldNames()[columnIndex].
Example fix
// before
DBCachedObjectIndex<String,T> idx = store.getIndex(String.class, store.getColumnByName("name"));
// throws "Column name is not indexed"
// after: declare the column indexed when creating the store
storeFactory.createIndexedStore("myTable", schema, Set.of("name")); // name now indexed Defensive patterns
Strategy: validation
Validate before calling
// Check the column is indexed before requesting its index
if (!ArrayUtils.contains(table.getIndexedColumns(), columnIndex)) {
// not indexed: declare it indexed in the store factory, or use a scan
} Prevention
- Declare columns as indexed in the store factory when you need value lookups.
- Use scan-based find for non-indexed columns.
- Confirm columnIndex maps to the intended column.
When it happens
Trigger: Calling getIndex on a column that was not registered as indexed in the store factory/schema. The table only knows indexed columns it was built with; a plain (non-indexed) field cannot be queried via an index.
Common situations: Forgetting to mark a field @DBAnnotatedObject indexed (or the factory's indexed-columns set) when you later need to look it up by value; schema change adding a lookup but not an index; assuming all columns are indexed.
Related errors
- Column {} is not of type {}! It is {}
- {}
- Given field does not apply to given object type
- Given field does not have the given type: {} != {}
- Too many constants in {} to encode as a byte
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/a33e3e882416f23d.
Report an issue: GitHub.