pinpoint-apm/pinpoint · warning

Can not find suitable ParentSpan.

Error message

Can not find suitable ParentSpan.(CurrentSpan:{})

What it means

When linking a span to its parent in the filtered map, getParentsSpan searches candidate parent spans (async or same-transaction spans) for one whose spanId matches the current span's parentSpanId and which is accepted. If no candidate matches, it falls back to the first candidate and logs this warning. The resulting link may connect the wrong parent.

Solutions

  1. Widen the filter or time range so the parent span is included in the queried trace
  2. Verify the agent correctly records parentSpanId for async spans (upgrade agent if buggy)
  3. Check whether expectedParentSpanId truly exists in HBase for this transactionId
  4. If fallback is acceptable, treat the warning as informational; otherwise reject incomplete traces

Example fix

// before
logger.warn("Can not find suitable ParentSpan.(CurrentSpan:{})", currentSpan);
return parentSpanCandidateList.get(0);
// after
logger.warn("Can not find suitable ParentSpan.(CurrentSpan:{}) candidates:{}", currentSpan, parentSpanCandidateList.size());
return parentSpanCandidateList.stream()
    .filter(s -> s.getSpanId() == currentSpan.getParentSpanId())
    .findFirst()
    .orElse(parentSpanCandidateList.get(0));
Defensive patterns

Strategy: fallback

Validate before calling

// verify the parent span exists before linking
boolean parentExists = spans.stream()
    .anyMatch(s -> s.getSpanId() == currentSpan.getParentSpanId());
if (!parentExists) {
    logger.warn("parent spanId {} missing; link may be inaccurate", currentSpan.getParentSpanId());
}

Prevention

When it happens

Trigger: A span's parentSpanId does not match any span in the transactionSpanMap's candidates — e.g. the parent span was filtered out, async spans referencing a missing parent, or parent spans not yet collected by the query.

Common situations: Trace filters that exclude the root/parent span; async/continuation traces where the parent lives in a different collector window; agents producing async spans whose parent span is dropped by sampling.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/161705b9c8d585b8. Report an issue: GitHub.

Appendix: source

Thrown at web/src/main/java/com/navercorp/pinpoint/web/applicationmap/map/FilteredMapBuilder.java:416

        } else {
            for (SpanBo parentSpanCandidate : parentSpanCandidateList) {
                SpanAcceptor acceptor = new SpanReader(Collections.singletonList(parentSpanCandidate));
                boolean accept = acceptor.accept(new SpanVisitor() {
                    @Override
                    public boolean visit(BasicSpan basicSpan, SpanEventBo spanEventBo) {
                        if (spanEventBo.getNextSpanId() == currentSpan.getSpanId()) {
                            return SpanVisitor.ACCEPT;
                        }
                        return SpanVisitor.REJECT;
                    }
                });

                if (accept) {
                    return parentSpanCandidate;
                }
            }

            logger.warn("Can not find suitable ParentSpan.(CurrentSpan:{})", currentSpan);
            return parentSpanCandidateList.get(0);
        }
    }

    private void addNodeFromSpanEvent(SpanBo span, Application srcApplication, MultiValueMap<Long, SpanBo> transactionSpanMap) {
        /*
         * add span event statistics
         */
        LinkDataMap sourceLinkDataMap = linkDataDuplexMap.getSourceLinkDataMap();

        SpanAcceptor acceptor = new SpanReader(Collections.singletonList(span));
        acceptor.accept(new SpanVisitor() {
            @Override
            public boolean visit(BasicSpan basicSpan, SpanEventBo spanEventBo) {
                if (basicSpan instanceof SpanBo spanBo) {
                    addNode(spanBo, transactionSpanMap, srcApplication, sourceLinkDataMap, spanEventBo);
                }
                return SpanVisitor.REJECT;

View on GitHub (pinned to 744c3d3075)