NationalSecurityAgency/ghidra · error · IllegalArgumentException

Value is not a known settings type

Error message

Value is not a known settings type

What it means

assertKnownType permits only Long, String, and byte[] as trace settings values; any other type throws IllegalArgumentException("Value is not a known settings type"). The DB settings codec persists only those three forms, so the type is constrained at the API boundary. Note Integer/Double/Boolean are NOT accepted (must be widened to Long or serialized).

Source

Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/data/DBTraceDataSettingsOperations.java:42

import ghidra.trace.database.map.DBTraceAddressSnapRangePropertyMapTree.TraceAddressSnapRangeQuery;
import ghidra.trace.model.Lifespan;
import ghidra.trace.model.map.TraceAddressSnapRangePropertyMapOperations;
import ghidra.util.LockHold;

public interface DBTraceDataSettingsOperations
		extends TraceAddressSnapRangePropertyMapOperations<DBTraceSettingsEntry> {

	static void assertKnownType(Object obj) {
		if (obj instanceof Long) {
			return;
		}
		if (obj instanceof String) {
			return;
		}
		if (obj instanceof byte[]) {
			return;
		}
		throw new IllegalArgumentException("Value is not a known settings type");
	}

	void makeWay(DBTraceSettingsEntry entry, Lifespan span);

	ReadWriteLock getLock();

	default DBTraceSettingsEntry doGetExactEntry(Lifespan lifespan, Address address,
			String name) {
		for (DBTraceSettingsEntry entry : reduce(
			TraceAddressSnapRangeQuery.at(address, lifespan.lmin())).values()) {
			if (!lifespan.equals(entry.getLifespan())) {
				continue;
			}
			if (!name.equals(entry.name)) {
				continue;
			}
			return entry;
		}

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Widen integer types to Long before storing.
  2. Serialize non-numeric types to String or byte[].
  3. Run a type guard (instanceof Long/String/byte[]) before calling the setter.

Example fix

// before
ops.setSetting(span, addr, "count", Integer.valueOf(5));

// after
ops.setSetting(span, addr, "count", Long.valueOf(5));
Defensive patterns

Strategy: type-guard

Validate before calling

static void checkSettingValue(Object v) {
    if (!(v instanceof Long || v instanceof String || v instanceof byte[]))
        throw new IllegalArgumentException("settings value must be Long, String, or byte[]");
}

Type guard

static boolean isKnownSettingType(Object v) {
    return v instanceof Long || v instanceof String || v instanceof byte[];
}

Prevention

When it happens

Trigger: Calling a settings setter on DBTraceDataSettingsOperations with an Integer, Short, Byte, Double, Float, Boolean, or arbitrary object.

Common situations: Assuming settings accept any boxed primitive; passing an enum or custom Serializable; forgetting to widen int to long.

Related errors


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