NationalSecurityAgency/ghidra · error · IllegalArgumentException

@DBAnnotatedColumn fields must be DBObjectColumn type. Got {

Error message

@DBAnnotatedColumn fields must be DBObjectColumn type. Got {}

What it means

The column-handle injection only knows how to write a DBObjectColumn instance into the field (via f.set(None, DBObjectColumn.get(columnNumber))). The annotation's contract is strictly a `static DBObjectColumn` field; the check is an exact-type comparison `f.getType() != DBObjectColumn.class`, so any other declared type - even a subclass of DBObjectColumn, or the value's domain type - is rejected.

Source

Thrown at Ghidra/Debug/ProposedUtils/src/main/java/ghidra/util/database/DBCachedObjectStoreFactory.java:1177

		void writeColumnNumbers(Class<? extends DBAnnotatedObject> objectType,
				Map<String, Integer> numbersByName) {
			Class<?> superType = objectType.getSuperclass();
			if (DBAnnotatedObject.class.isAssignableFrom(superType)) {
				writeColumnNumbers(superType.asSubclass(DBAnnotatedObject.class), numbersByName);
			}
			for (Field f : objectType.getDeclaredFields()) {
				DBAnnotatedColumn annotation = f.getAnnotation(DBAnnotatedColumn.class);
				if (annotation == null) {
					continue;
				}
				int mod = f.getModifiers();
				if (!Modifier.isStatic(mod)) {
					throw new IllegalArgumentException(
						"@" + DBAnnotatedColumn.class.getSimpleName() +
							" fields must be static. Got " + f);
				}
				if (f.getType() != DBObjectColumn.class) {
					throw new IllegalArgumentException(
						"@" + DBAnnotatedColumn.class.getSimpleName() + " fields must be " +
							DBObjectColumn.class.getSimpleName() + " type. Got " + f);
				}

				String name = annotation.value();

				Integer columnNumber = numbersByName.get(name);
				if (columnNumber == null) {
					throw new IllegalArgumentException("Cannot find column '" + name + "' for @" +
						DBAnnotatedColumn.class.getSimpleName() + " on " + f);
				}

				f.setAccessible(true);
				try {
					DBObjectColumn already = (DBObjectColumn) f.get(null);
					if (already == null) {
						f.set(null, DBObjectColumn.get(columnNumber.intValue()));
					}

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Change the field's declared type to exactly DBObjectColumn.
  2. Keep the `static` modifier from the prior check.
  3. If you wanted stored data, use @DBAnnotatedField and a supported value type instead.

Example fix

// before
@DBAnnotatedColumn("name")
static String NAME;
// after
@DBAnnotatedColumn("name")
static DBObjectColumn NAME;
Defensive patterns

Strategy: validation

Validate before calling

for (Field f : objectType.getDeclaredFields()) {
    if (f.isAnnotationPresent(DBAnnotatedColumn.class) && f.getType() != DBObjectColumn.class) {
        throw new IllegalStateException("@DBAnnotatedColumn field must be DBObjectColumn: " + f);
    }
}

Prevention

When it happens

Trigger: A field annotated @DBAnnotatedColumn whose declared type is not exactly DBObjectColumn.class (e.g. `static String NAME`, `static Long NAME`, or `static MyColSubclass NAME`). Hit when writeColumnNumbers runs during store construction.

Common situations: Declaring the handle as the value type (String/Long) instead of DBObjectColumn; using a DBObjectColumn subclass; copy-paste where the type was left as the domain type.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/01d11bc4fae596f9. Report an issue: GitHub.