NationalSecurityAgency/ghidra · error · IllegalArgumentException
No codec for type {}
Error message
No codec for type {} What it means
Thrown by AutoConfigState.ConfigStateField.putState() when getCodecByType(type) returns null, i.e., the value's type has no registered ConfigFieldCodec. SaveState only supports a fixed set of primitive/wrapper/String/array/File/Path/Enum/BigInteger types; any other type cannot be serialized and registration aborts. The message names the unsupported type.
Source
Thrown at Ghidra/Debug/ProposedUtils/src/main/java/ghidra/framework/plugintool/AutoConfigState.java:492
}
/**
* Put an object into a {@link SaveState} using a known codec
*
* <p>
* This seems like something that should be in SaveState itself, but the object value must
* be one of the supported types.
*
* @param <T> the type of the value
* @param state the state to write into
* @param type the type of the value
* @param name the name of the name-value pair
* @param value the value of the name-value pair
*/
public static <T> void putState(SaveState state, Class<T> type, String name, T value) {
ConfigFieldCodec<T> codec = getCodecByType(type);
if (codec == null) {
throw new IllegalArgumentException("No codec for type " + type);
}
codec.write(state, name, value);
}
/**
* Get an object from a {@link SaveState} using a known codec
*
* <p>
* This seems like something that should be in SaveState itself.
*
* @param <T> the type of the value
* @param state the state to read from
* @param type the expected type of the value
* @param name the name of the name-value pair
* @return the value of the name-value pair
*/
public static <T> T getState(SaveState state, Class<T> type, String name) {
ConfigFieldCodec<T> codec = getCodecByType(type);View on GitHub (pinned to d5f144c24d)
Solutions
- Use a supported type (String, int, boolean, enum, File, Path, BigInteger, or a primitive array).
- Implement a ConfigFieldCodec<T> for the custom type and reference it via @AutoConfigStateField(codec=MyCodec.class).
- Serialize the custom object to a String or byte[] and store that instead.
Example fix
// before ConfigStateField.putState(state, MyPojo.class, "pojo", pojo); // no codec // after // option A: convert to supported type ConfigStateField.putState(state, String.class, "pojo", pojo.toJson()); // option B: register a custom codec via @AutoConfigStateField(codec = MyPojoCodec.class)
Defensive patterns
Strategy: validation
Validate before calling
ConfigFieldCodec<?> codec = AutoConfigState.ConfigStateField.getCodecByType(type);
if (codec == null) {
throw new IllegalStateException("No codec for " + type + "; convert or register one");
}
ConfigStateField.putState(state, type, name, value); Type guard
static boolean hasCodec(Class<?> type) {
return AutoConfigState.ConfigStateField.getCodecByType(type) != null;
} Prevention
- Use only supported types or supply a custom ConfigFieldCodec.
- Convert custom objects to String/byte[] before storing.
- Keep a list of supported types handy when adding config fields.
When it happens
Trigger: Calling putState with a type not in the codec registry, such as a custom POJO, a List, a Map, LocalDate, or an arbitrary domain class. An @AutoConfigStateField whose field type lacks a codec and whose annotation codec() defaults to DefaultConfigFieldCodec.
Common situations: Adding a config field of an unsupported type without supplying a custom codec; expecting SaveState to handle arbitrary objects; version upgrades that introduce new field types.
Related errors
- Unsupported value: {}
- Invalid value for {}
- No such address space: %s
- Current trace does not use Sleigh
- Failed to read memory
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/508e3821aad74a2a.
Report an issue: GitHub.