apache/skywalking · error · IllegalArgumentException

time field is required when uuid is absent.

Error message

time field is required when uuid is absent.

What it means

EventQueryService.queryEvents() requires every query condition to be scoped: either a specific event 'uuid' or a 'time' range with both start and end. When uuid is blank AND the time Duration is null or missing start/end (isDurationInvalid), the DAO filter would match unbounded data, so the service throws IllegalArgumentException before touching storage. The same rule applies to every condition in the list overload (error 268).

Source

Thrown at oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/EventQueryService.java:59

    private final ModuleManager moduleManager;

    private IEventQueryDAO dao;

    public EventQueryService(ModuleManager moduleManager) {
        this.moduleManager = moduleManager;
    }

    private IEventQueryDAO getDao() {
        if (dao == null) {
            dao = moduleManager.find(StorageModule.NAME).provider().getService(IEventQueryDAO.class);
        }
        return dao;
    }

    public Events queryEvents(final EventQueryCondition condition) throws Exception {
        if (isBlank(condition.getUuid()) && isDurationInvalid(condition.getTime())) {
            throw new IllegalArgumentException("time field is required when uuid is absent.");
        }
        Events events = getDao().queryEvents(condition);
        return mergeAndSortEvents(events, condition.getOrder());
    }

    public Events queryEvents(final List<EventQueryCondition> conditions) throws Exception {
        EventQueryCondition condition = conditions.stream().filter(c -> isBlank(c.getUuid()) && isDurationInvalid(c.getTime())).findFirst().orElse(null);
        if (Objects.nonNull(condition)) {
            throw new IllegalArgumentException("time field is required when uuid is absent.");
        }
        Events events = getDao().queryEvents(conditions);
        return mergeAndSortEvents(events, conditions.get(0).getOrder());
    }

    boolean isDurationInvalid(final Duration duration) {
        return isNull(duration) || (isBlank(duration.getStart()) || isBlank(duration.getEnd()));
    }

View on GitHub (pinned to 102af09b4a)

Solutions

  1. Add a time window to the condition: time.start and time.end (formatted per the step, e.g. '2026-08-14 1000' for MINUTE).
  2. Or, when looking up one known event, set condition.uuid instead.
  3. For the list overload, ensure every element in conditions satisfies the same rule — the service scans the list and rejects the first invalid entry.

Example fix

# GraphQL — before
condition: { source: Service, name: "my-service" }

# after
condition: { source: Service, name: "my-service", time: { step: MINUTE, start: "2026-08-14 0800", end: "2026-08-14 1200" } }
Defensive patterns

Strategy: validation

Validate before calling

boolean scoped = isNotBlank(condition.getUuid())
    || (condition.getTime() != null
        && isNotBlank(condition.getTime().getStart())
        && isNotBlank(condition.getTime().getEnd()));
if (!scoped) condition.setTime(lastHalfHourDuration()); // or reject

Type guard

boolean isEventQueryScopesValid(EventQueryCondition c) { return c != null && (StringUtils.isNotBlank(c.getUuid()) || (c.getTime() != null && StringUtils.isNotBlank(c.getTime().getStart()) && StringUtils.isNotBlank(c.getTime().getEnd()))); }

Try / catch

try { events = eventQueryService.queryEvents(condition); } catch (IllegalArgumentException e) { if (e.getMessage().contains("time field is required")) { condition.setTime(defaultWindow()); events = eventQueryService.queryEvents(condition); } else throw e; }

Prevention

When it happens

Trigger: Calling queryEvents with an EventQueryCondition that has no 'uuid' and either no 'time' object, or a Duration whose start/end strings are blank.

Common situations: UI 'Events' tab sending only a metric-name or scope filter without a time window; GraphQL clients omitting time because they assume a server default; constructing conditions programmatically and forgetting setTime().

Related errors


AI-assisted analysis of apache/skywalking@102af09b4a (2026-08-14). Data as JSON: /api/errors/f785b1eda2e120b1. Report an issue: GitHub.