chinabugotech/hutool · error · UnsupportedOperationException

Task info is not being kept!

Error message

Task info is not being kept!

What it means

Error "Task info is not being kept!" thrown in chinabugotech/hutool.

Solutions

  1. Construct the StopWatch with keepTaskList enabled so task info is retained.
  2. Avoid calling getTaskInfo() when task keeping is disabled.

When it happens

Trigger: Thrown at hutool-core/src/main/java/cn/hutool/core/date/StopWatch.java:316 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of chinabugotech/hutool@8870454b2a (2026-08-14). Data as JSON: /api/errors/ec49011f9e73c1dc. Report an issue: GitHub.

Appendix: source

Thrown at hutool-core/src/main/java/cn/hutool/core/date/StopWatch.java:316

	}

	/**
	 * 获取任务数
	 *
	 * @return 任务数
	 */
	public int getTaskCount() {
		return this.taskCount;
	}

	/**
	 * 获取任务列表
	 *
	 * @return 任务列表
	 */
	public TaskInfo[] getTaskInfo() {
		if (null == this.taskList) {
			throw new UnsupportedOperationException("Task info is not being kept!");
		}
		return this.taskList.toArray(new TaskInfo[0]);
	}

	/**
	 * 获取任务信息,类似于:
	 * <pre>
	 *     StopWatch '[id]': running time = [total] ns
	 * </pre>
	 *
	 * @return 任务信息
	 */
	public String shortSummary() {
		return shortSummary(null);
	}

	/**
	 * 获取任务信息,类似于:

View on GitHub (pinned to 8870454b2a)