{"record":{"id":"8226d2dc8e18fbb8","repo":"chinabugotech/hutool","slug":"no-tasks-run-can-t-get-last-task-interval","errorCode":null,"errorMessage":"No tasks run: can't get last task interval","messagePattern":"No tasks run: can't get last task interval","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"hutool-core/src/main/java/cn/hutool/core/date/StopWatch.java","lineNumber":212,"sourceCode":"\t/**\n\t * 获取当前任务名，{@code null} 表示无任务\n\t *\n\t * @return 当前任务名，{@code null} 表示无任务\n\t * @see #isRunning()\n\t */\n\tpublic String currentTaskName() {\n\t\treturn this.currentTaskName;\n\t}\n\n\t/**\n\t * 获取最后任务的花费时间（纳秒）\n\t *\n\t * @return 任务的花费时间（纳秒）\n\t * @throws IllegalStateException 无任务\n\t */\n\tpublic long getLastTaskTimeNanos() throws IllegalStateException {\n\t\tif (this.lastTaskInfo == null) {\n\t\t\tthrow new IllegalStateException(\"No tasks run: can't get last task interval\");\n\t\t}\n\t\treturn this.lastTaskInfo.getTimeNanos();\n\t}\n\n\t/**\n\t * 获取最后任务的花费时间（毫秒）\n\t *\n\t * @return 任务的花费时间（毫秒）\n\t * @throws IllegalStateException 无任务\n\t */\n\tpublic long getLastTaskTimeMillis() throws IllegalStateException {\n\t\tif (this.lastTaskInfo == null) {\n\t\t\tthrow new IllegalStateException(\"No tasks run: can't get last task interval\");\n\t\t}\n\t\treturn this.lastTaskInfo.getTimeMillis();\n\t}\n\n\t/**","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/chinabugotech/hutool/blob/8870454b2a0c29cc6ffd31dcf5667c8ceb2fc442/hutool-core/src/main/java/cn/hutool/core/date/StopWatch.java#L194-L230","documentation":"Error \"No tasks run: can't get last task interval\" thrown in chinabugotech/hutool.","triggerScenarios":"Thrown at hutool-core/src/main/java/cn/hutool/core/date/StopWatch.java:212 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run at least one start()/stop() cycle before querying the last task interval.","Check getTaskCount() > 0 before accessing last task info."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8870454b2a0c29cc6ffd31dcf5667c8ceb2fc442","analyzedAt":"2026-08-14T04:01:12.892Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}