{"record":{"id":"17073c15b7affcdf","repo":"alibaba/arthas","slug":"optionname-is-invalid-value","errorCode":null,"errorMessage":"{optionName} is invalid: {value}","messagePattern":"(.+?) is invalid: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"warning","filePath":"core/src/main/java/com/taobao/arthas/core/command/klass100/ClassLoaderMetaspaceCommand.java","lineNumber":480,"sourceCode":"        long multiplier = 1;\n        if (text.endsWith(\"ms\")) {\n            text = text.substring(0, text.length() - 2).trim();\n        } else if (text.endsWith(\"s\")) {\n            text = text.substring(0, text.length() - 1).trim();\n            multiplier = 1000;\n        } else if (text.endsWith(\"m\")) {\n            text = text.substring(0, text.length() - 1).trim();\n            multiplier = 60 * 1000;\n        }\n\n        try {\n            long millis = Long.parseLong(text) * multiplier;\n            if (millis <= 0) {\n                throw new IllegalArgumentException(optionName + \" must be greater than 0.\");\n            }\n            return millis;\n        } catch (NumberFormatException e) {\n            throw new IllegalArgumentException(optionName + \" is invalid: \" + value);\n        }\n    }\n\n    private void logMappingSummary(MappingSummary summary) {\n        logger.debug(\"{} mapping summary, loadedClasses={}, candidateLoaders={}, emittedMappings={}, bootstrapClasses={}, arrayClasses={}, primitiveClasses={}, duplicateLoaderClasses={}\",\n                DIAG_LOG_PREFIX, summary.loadedClassCount, summary.candidateLoaderCount, summary.emittedMappingCount,\n                summary.bootstrapClassCount, summary.arrayClassCount, summary.primitiveClassCount,\n                summary.duplicateLoaderClassCount);\n    }\n\n    private void logRecordingSummary(RecordingData data, long recordingSize) {\n        logger.debug(\"{} recording summary, fileSizeBytes={}, statsEvents={}, distinctStatsRows={}, mappingEvents={}, fallbackMappings={}, mappedLoaderIds={}, mappingEventsWithoutLoader={}, duplicateStatsRows={}\",\n                DIAG_LOG_PREFIX, recordingSize, data.statsEventCount, data.statsRows.size(), data.mappingEventCount,\n                data.fallbackMappings.size(), data.mappingByLoaderId.size(), data.mappingEventWithoutLoaderCount,\n                data.duplicateStatsRowCount);\n        if (data.mappingEventWithoutLoaderCount > 0) {\n            logger.debug(\"{} mapping events without RecordedClassLoader. These events can still be used as fallback candidates. samples={}\",\n                    DIAG_LOG_PREFIX, data.mappingEventsWithoutLoaderSamples);","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/alibaba/arthas/blob/21cf2e9ba52b305290be7223b980ff504bb9cb5b/core/src/main/java/com/taobao/arthas/core/command/klass100/ClassLoaderMetaspaceCommand.java#L462-L498","documentation":"Thrown as IllegalArgumentException by parseTimeMillis when Long.parseLong(text) throws NumberFormatException — i.e. the numeric body of the value is not a valid integer. The unit suffix was stripped correctly (or absent), but the remaining text is non-numeric. The original value is echoed.","triggerScenarios":"Pass a time option value whose body is non-numeric after unit stripping: 'abc', '5x' (unknown unit falls through as literal), '1.5s' (decimal), '', or text with stray characters. Unsupported suffixes are NOT stripped, so '5x' leaves '5x' which fails parseLong.","commonSituations":"User uses an unsupported unit ('5min' -> body '5min'), decimals ('1.5s'), or non-numeric junk; mismatch between expected suffix vocabulary (ms/s/m) and what the user typed.","solutions":["Use only supported suffixes ms, s, m with an integer body (e.g. 5s, 200ms, 3m).","Avoid decimals and unsupported units like min/sec/h.","Double-check the echoed value in the message to spot typos."],"exampleFix":"// before\nclassloader --refresh-interval 1.5s\n\n// after\nclassloader --refresh-interval 2s","handlingStrategy":"validation","validationCode":"if (!value.matches(\"(?i)\\\\d+(ms|s|m)?\")) {\n    // reject before calling parseTimeMillis\n}","typeGuard":"static boolean isValidMillisDuration(String s) { return s != null && s.matches(\"(?i)\\\\d+(ms|s|m)?\"); }","tryCatchPattern":"try { long ms = parseTimeMillis(value, optionName); } catch (IllegalArgumentException e) { /* echo value back to the user with valid-unit guidance */ }","preventionTips":["Use only supported suffixes (ms, s, m) with an integer body.","Avoid decimals and unsupported units like min/sec/h.","Echo the offending value in error messages to help users self-correct."],"tags":["classloader","user-input","parsing","validation"],"backgroundTag":null,"analyzedSha":"21cf2e9ba52b305290be7223b980ff504bb9cb5b","analyzedAt":"2026-08-14T00:57:07.243Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}