SonarSource/sonarqube · warning

Node [ ] has critically low disk space: % free ( bytes…

Error message

Node [{}] has critically low disk space: {}% free ({} bytes available out of {} bytes total)

What it means

ElasticSearchMetricTask polls ES cluster node stats and records max disk usage as a metric. When a node's free disk percentage falls below the configured threshold, it logs this warning identifying the node, free percent, and byte counts.

Solutions

  1. Free disk space on the reported Elasticsearch node (delete old indexes, snapshot and prune)
  2. Verify the low-disk threshold configuration matches operational expectations
  3. Add or fix index lifecycle/retention policies so disk usage does not trend to the threshold
  4. Scale the node's disk or add nodes to the ES cluster
Defensive patterns

Strategy: validation

Validate before calling

if (freePercent < thresholdPercent) { provisionMoreDisk(node); }

Type guard

boolean hasUsableStat(NodeStat s) { return s != null && s.getTotalBytes() > 0; }

Prevention

When it happens

Trigger: A scheduled ES monitoring task run finds a node stat whose freePercent < thresholdPercent while totalBytes > 0 in updateAndGetMaxDiskUsagePercent.

Common situations: Elasticsearch data nodes filling up with indexes; too-small disks after index growth; missing ILM/retention policies causing unbounded index accumulation.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09). Data as JSON: /api/errors/364a8dac794c5c0a. Report an issue: GitHub.

Appendix: source

Thrown at server/sonar-webserver-monitoring/src/main/java/org/sonar/server/monitoring/ElasticSearchMetricTask.java:171

  private double updateAndGetMaxDiskUsagePercent(@Nullable NodeStatsResponse nodeStatsResponse, double thresholdPercent) {
    try {
      if (nodeStatsResponse == null || nodeStatsResponse.getNodeStats().isEmpty()) {
        return 0.0;
      }

      double maxDiskUsagePercent = 0.0;

      for (NodeStats nodeStat : nodeStatsResponse.getNodeStats()) {
        final long availableBytes = nodeStat.getDiskAvailableBytes();
        final long totalBytes = nodeStat.getDiskTotalBytes();

        if (totalBytes > 0) {
          final double freePercent = (availableBytes * 100.0) / totalBytes;
          final double usedPercent = 100.0 - freePercent;
          maxDiskUsagePercent = Math.max(maxDiskUsagePercent, usedPercent);

          if (freePercent < thresholdPercent) {
            LOG.warn("Node [{}] has critically low disk space: {}% free ({} bytes available out of {} bytes total)",
              nodeStat.getName(), String.format(Locale.ROOT, "%.2f", freePercent), availableBytes, totalBytes);
          }
        }
      }

      // Update metric for observability
      serverMonitoringMetrics.setElasticSearchDiskUsagePercent(maxDiskUsagePercent);

      return maxDiskUsagePercent;
    } catch (Exception e) {
      LOG.error("Failed to check disk space", e);
      // Return 0.0 on error to avoid false positives
      return 0.0;
    }
  }

  @Override
  public long getDelay() {

View on GitHub (pinned to 184c821202)