SonarSource/sonarqube · warning

Can't report metric data for a CE task with entity uuid

Error message

Can't report metric data for a CE task with entity uuid {}

What it means

RecentTasksDurationTask reports observed CE task durations as Prometheus metrics, choosing a label-based metric for user tasks and a system metric otherwise. If metric reporting throws a RuntimeException, it is logged per task with the task's entity uuid instead of failing the whole run.

Solutions

  1. Read the attached exception `e` for the actual metric-reporting failure
  2. Check the task's getTaskType() for a value the metrics layer doesn't expect
  3. Verify Prometheus client/registry configuration is initialized before the task runs
  4. Report the entity uuid from the log to correlate with the CE task row
Defensive patterns

Strategy: try-catch

Validate before calling

if (task.getTaskType() == null || executionTimeMs < 0) return; // skip invalid task before metric call

Try / catch

try { metrics.observeComputeEngineTaskDuration(ms, type, label); } catch (RuntimeException e) { log.warn("metric report failed for entity {}", entityUuid, e); }

Prevention

When it happens

Trigger: metrics.observeComputeEngineTaskDuration or observeComputeEngineSystemTaskDuration throws RuntimeException while processing a finished CE task with the given entity uuid.

Common situations: Prometheus registry rejecting a label value (e.g. unexpected task type); concurrent metric registration issues; empty/invalid executionTimeMs.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


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

Appendix: source

Thrown at server/sonar-webserver-monitoring/src/main/java/org/sonar/server/monitoring/ce/RecentTasksDurationTask.java:93

      .toList();
  }

  private void reportObservedDurationForTasks(List<CeActivityDto> tasks, Map<String, String> entityUuidAndKeys) {
    for (CeActivityDto task : tasks) {
      String entityUuid = task.getEntityUuid();
      Long executionTimeMs = task.getExecutionTimeMs();
      try {
        requireNonNull(executionTimeMs);

        if (entityUuid != null) {
          String label = entityUuidAndKeys.get(entityUuid);
          requireNonNull(label);
          metrics.observeComputeEngineTaskDuration(executionTimeMs, task.getTaskType(), label);
        } else {
          metrics.observeComputeEngineSystemTaskDuration(executionTimeMs, task.getTaskType());
        }
      } catch (RuntimeException e) {
        LOGGER.warn("Can't report metric data for a CE task with entity uuid " + entityUuid, e);
      }
    }
  }

}

View on GitHub (pinned to 184c821202)