{"record":{"id":"4c948abb0bf1eac9","repo":"apache/skywalking","slug":"unknown-identifier-used-as-method-argument-text","errorCode":null,"errorMessage":"Unknown identifier used as method argument: '{text}'","messagePattern":"Unknown identifier used as method argument: '(.+?)'","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/v2/compiler/LALValueCodegen.java","lineNumber":1770,"sourceCode":"                final String text = va.getSegments().get(0);\n                if (\"true\".equals(text) || \"false\".equals(text)\n                        || \"null\".equals(text)) {\n                    // Boolean or null literal\n                    sb.append(text);\n                } else if (genCtx != null\n                        && genCtx.localVars.containsKey(text)) {\n                    // Local def variable reference\n                    sb.append(genCtx.localVars.get(text).javaVarName);\n                } else if (genCtx != null\n                        && (va.isParsedRef() || va.isLogRef()\n                            || !va.getChain().isEmpty()\n                            || va.getFunctionCallName() != null\n                            || va.getParenInner() != null)) {\n                    // tag(), parsed.*, log.*, paren-cast, or any value\n                    // access with a chain — render via the standard path.\n                    generateValueAccess(sb, va, genCtx);\n                } else {\n                    throw new IllegalArgumentException(\n                        \"Unknown identifier used as method argument: '\" + text + \"'\");\n                }\n            } else {\n                sb.append(\"null\");\n            }\n        }\n        return sb.toString();\n    }\n}\n","sourceCodeStart":1752,"sourceCodeEnd":1780,"githubUrl":"https://github.com/apache/skywalking/blob/102af09b4a56064e22050dded10e2c52e490d040/oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/v2/compiler/LALValueCodegen.java#L1752-L1780","documentation":"Thrown at LAL compile time when an identifier appears as a method-call argument and matches none of the recognized forms: not a known literal type, not a def-declared local variable in genCtx.localVars, and not a value access (parsed/log ref, chain, function call, or parenthesized expression). It is the argument-position guard equivalent of the general 'no matching codegen path' error.","triggerScenarios":"Method calls like toJsonArray(items) or toJson(data) where 'items'/'data' was never declared with def; using a variable declared inside a different block/rule; bare identifiers with no root qualifier.","commonSituations":"Forgetting the def declaration when refactoring a rule; referencing a def variable before its def statement in the generated method ordering; splitting a complex expression into helper variables but omitting one declaration.","solutions":["Declare the identifier with def first, e.g. def data = parsed.payload, then use toJson(data)","If it should be a string, quote it: toJson(\"literal\")","If it is a field of the input, qualify it: parsed.payload or log.body","Move the def statement above the method call that consumes it"],"exampleFix":"# before\nextractor {\n  def obj = toJson(payload)\n}\n\n# after\nextractor {\n  def payload = parsed.payload\n  def obj = toJson(payload)\n}","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare def variables above their first use","Quote string literals passed to built-in functions","Keep one rule per concern so variable scope is obvious"],"tags":["lal","log-analyzer","compiler","identifier","expression"],"backgroundTag":null,"analyzedSha":"102af09b4a56064e22050dded10e2c52e490d040","analyzedAt":"2026-08-14T10:47:52.647Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}