{"record":{"id":"b9a65c492ad42c0b","repo":"apache/skywalking","slug":"funcname-requires-exactly-1-argument-got-arg","errorCode":null,"errorMessage":"{funcName}() requires exactly 1 argument, got {argCount}","messagePattern":"(.+?)\\(\\) requires exactly 1 argument, got (.+?)","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/LALDefCodegen.java","lineNumber":99,"sourceCode":"    static void generateDefStatement(final StringBuilder sb,\n                                      final LALScriptModel.DefStatement def,\n                                      final LALClassGenerator.GenCtx genCtx) {\n        final LALScriptModel.ValueAccess init = def.getInitializer();\n        final String varName = def.getVarName();\n        final String javaVar = \"_def_\" + varName;\n        final boolean alreadyDeclared = genCtx.localVars.containsKey(varName);\n\n        // Determine type and generate initializer expression\n        Class<?> resolvedType;\n        final StringBuilder initExpr = new StringBuilder();\n\n        if (init.getFunctionCallName() != null\n                && LALBlockCodegen.BUILTIN_FUNCTIONS.containsKey(init.getFunctionCallName())) {\n            // Built-in function: toJson(...), toJsonArray(...)\n            final String funcName = init.getFunctionCallName();\n            final int argCount = init.getFunctionCallArgs().size();\n            if (argCount != 1) {\n                throw new IllegalArgumentException(\n                    funcName + \"() requires exactly 1 argument, got \" + argCount);\n            }\n            final Object[] info = LALBlockCodegen.BUILTIN_FUNCTIONS.get(funcName);\n            final String helperMethod = (String) info[0];\n            resolvedType = (Class<?>) info[1];\n\n            initExpr.append(helperMethod).append(\"(\");\n            LALValueCodegen.generateValueAccess(initExpr,\n                init.getFunctionCallArgs().get(0).getValue(), genCtx);\n            initExpr.append(\")\");\n        } else {\n            // General value access — type inferred from lastResolvedType\n            LALValueCodegen.generateValueAccess(initExpr, init, genCtx);\n            resolvedType = genCtx.lastResolvedType != null\n                ? genCtx.lastResolvedType : Object.class;\n            // Box primitive types for local variable declarations\n            if (resolvedType.isPrimitive()) {\n                final String boxName = LALCodegenHelper.boxTypeName(resolvedType);","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/apache/skywalking/blob/102af09b4a56064e22050dded10e2c52e490d040/oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/v2/compiler/LALDefCodegen.java#L81-L117","documentation":"Thrown by TimeBucket.getTimestamp(long) when the argument matches none of the recognized time-bucket shapes. A timeBucket is a digit-packed long (yyyyMMddHHmmss for second, yyyyMMddHHmm for minute, yyyyMMddHH for hour, yyyyMMdd for day); the method infers the precision by numeric range checks and rejects anything outside all of them.","triggerScenarios":"Calling TimeBucket.getTimestamp(bucket) with a value that is not a valid packed bucket: a raw epoch millis timestamp, a truncated/zero value, or a day bucket like 20240711 (which is below the minute range and only valid if isDayBucket accepts it — values outside 10_000_000_000_000..99_999_999_999_999 and the other range windows throw).","commonSituations":"Passing epoch milliseconds where a timeBucket long was expected; reading a corrupt or empty time_bucket column from storage; arithmetic that truncated a bucket (e.g. dividing a minute bucket incorrectly) before the call.","solutions":["Check the value with TimeBucket.isSecondBucket/isMinuteBucket/isHourBucket/isDayBucket before calling getTimestamp","If you hold an epoch timestamp, build the bucket with TimeBucket.getTimeBucket(ms, DownSampling.Minute) instead","Log/inspect the offending long — its digit count (13-14 = second, 12 = minute, 10 = hour, 8 = day) tells you which pipeline produced it"],"exampleFix":"// before\nlong ts = TimeBucket.getTimestamp(input); // throws on malformed input\n// after\nif (!TimeBucket.isSecondBucket(input) && !TimeBucket.isMinuteBucket(input)\n        && !TimeBucket.isHourBucket(input) && !TimeBucket.isDayBucket(input)) {\n    throw new IllegalArgumentException(\"malformed timeBucket: \" + input);\n}\nlong ts = TimeBucket.getTimestamp(input);","handlingStrategy":"validation","validationCode":"boolean wellFormed = TimeBucket.isSecondBucket(b) || TimeBucket.isMinuteBucket(b)\n    || TimeBucket.isHourBucket(b) || TimeBucket.isDayBucket(b);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never pass epoch millis into timeBucket APIs — convert with getTimeBucket first","Digit-count sanity check: 8=day, 10=hour, 12=minute, 14=second"],"tags":["skywalking","oap","time-bucket","validation","data-corruption"],"backgroundTag":null,"analyzedSha":"102af09b4a56064e22050dded10e2c52e490d040","analyzedAt":"2026-08-14T10:47:52.647Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}