apache/skywalking · error · IllegalArgumentException
Output field '{fieldName}' requires outputType to be set in
Error message
Output field '{fieldName}' requires outputType to be set in the LAL rule config What it means
Thrown by Layer.valueOf(int) when no registered layer has that ordinal — mirrors the enum-generated valueOf contract of the pre-registry Layer enum. It fires when an int read from persisted storage, a protocol message, or configuration does not map to any live layer in this OAP process.
Source
Thrown at oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/v2/compiler/LALBlockCodegen.java:481
* <p>LAL: {@code latency parsed.latency as Long}
* (where {@code latency} is not a standard field but a field on the
* {@code outputType} class, e.g. {@code SampledTrace.setLatency(long)})
* <br>Generated: {@code _o.setLatency(h.toLong(h.mapVal("latency")))}
*
* <p>The setter is validated at compile time via reflection on the
* output type. If no matching setter exists, compilation fails.
*/
static void generateOutputFieldAssignment(
final StringBuilder sb,
final LALScriptModel.OutputFieldAssignment field,
final LALClassGenerator.GenCtx genCtx) {
final String fieldName = field.getFieldName();
final String setterName = "set"
+ Character.toUpperCase(fieldName.charAt(0))
+ fieldName.substring(1);
if (genCtx.outputType == null) {
throw new IllegalArgumentException(
"Output field '" + fieldName + "' requires outputType to be set in the LAL rule config");
}
// Compile-time validation: verify the setter exists on the output type
final Method setter = findSetter(genCtx.outputType, setterName);
if (setter == null) {
throw new IllegalArgumentException(
"Output type " + genCtx.outputType.getName()
+ " has no setter " + setterName
+ "() for output field '" + fieldName + "'");
}
// Generate direct setter call: _o.setXxx(value)
// _o is declared once at the top of the extractor method
final Class<?> paramType = setter.getParameterTypes()[0];
sb.append(" _o.").append(setterName).append("(");
final String effectiveCast = resolveEffectiveCast(paramType, field.getCastType());
if (paramType.isEnum()) {View on GitHub (pinned to 102af09b4a)
Solutions
- Register the missing layer before reading (declare it in layer-extensions.yml or the matching layerDefinitions block) so the ordinal resolves
- Use Layer.nameOf(String)/lenient lookups where possible, or Layer.values() to enumerate valid ordinals when validating external input
- Resolve version skew: run the OAP version that knows the ordinal, or migrate the stored data
Example fix
// before
Layer layer = Layer.valueOf(rawOrdinal); // throws if unregistered
// after
Layer layer = java.util.Arrays.stream(Layer.values())
.filter(l -> l.value() == rawOrdinal)
.findFirst()
.orElse(Layer.UNDEFINED); Defensive patterns
Strategy: fallback
Validate before calling
Layer layer = java.util.Arrays.stream(Layer.values())
.filter(l -> l.value() == rawOrdinal)
.findFirst().orElse(Layer.UNDEFINED); Try / catch
try { layer = Layer.valueOf(v); } catch (UnexpectedException e) { layer = Layer.UNDEFINED; log.warn("unknown layer ordinal {}", v); } Prevention
- Prefer lenient lookups when reading persisted/external ints
- Re-declare dynamic layers (layerDefinitions) on every OAP start so persisted ordinals resolve
When it happens
Trigger: Deserializing a storage row, agent/protocol payload, or config value containing a layer ordinal that was never registered in this process — e.g. ordinal 42 from a newer OAP version read by an older one, or a dynamic layer ordinal after a restart that no longer registers it.
Common situations: Version skew between the writer and reader of layer ordinals (built-ins are frozen, but new built-ins appear in newer releases); dynamic layers (100_000+) not being re-declared after restart, leaving persisted data pointing at dead ordinals; corrupted or hand-crafted data.
Related errors
- Output type {outputTypeName} has no setter {setterName}() fo
- Load meter analyzer configs failed
- Failed to load GenAI configuration file.
- Failed to compile hierarchy rule: {name}, expression: {expre
- Hierarchy rule parsing failed: {errors} in expression: {expr
AI-assisted analysis of apache/skywalking@102af09b4a (2026-08-14).
Data as JSON: /api/errors/e1e041c1b067878b.
Report an issue: GitHub.