apache/hadoop · error · IllegalArgumentException

Unable to parse the specified timestamp

Error message

Unable to parse the specified timestamp 

What it means

Error "Unable to parse the specified timestamp " thrown in apache/hadoop.

Source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/TouchCommands.java:183

          return;
        }
        item.fs.create(item.path).close();
        if (timestamp != null) {
          // update the time only if user specified a timestamp using -t option.
          updateTime(item);
        }
      } else {
        updateTime(item);
      }
    }

    private void updateTime(PathData item) throws IOException {
      long time = System.currentTimeMillis();
      if (timestamp != null) {
        try {
          time = dateFormat.parse(timestamp).getTime();
        } catch (ParseException e) {
          throw new IllegalArgumentException(
              "Unable to parse the specified timestamp "+ timestamp
              + ". The expected format is " + dateFormat.toPattern(), e);
        }
      }
      if (changeModTime ^ changeAccessTime) {
        long atime = changeModTime ? -1 : time;
        long mtime = changeAccessTime ? -1 : time;
        item.fs.setTimes(item.path, mtime, atime);
      } else {
        item.fs.setTimes(item.path, time, time);
      }
    }
  }
}

View on GitHub (pinned to 2add963021)

Solutions

  1. Pass the timestamp in the expected format (yyyyMMddHHmmss) for the -t option.
  2. Check the timestamp string for invalid characters or wrong length.

When it happens

Trigger: Thrown by the touch shell command when the -d timestamp argument cannot be parsed into a valid date.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/155cb893b58e941d. Report an issue: GitHub.