openzipkin/zipkin · error · NullPointerException

parent == null

Error message

parent == null

What it means

DependencyLink.Builder.parent throws NullPointerException when the parent service name is null. A DependencyLink edge is defined by its parent and child names; a null parent would make the link unencodable and meaningless. Note the builder also lowercases the name, so it must be a real string.

Source

Thrown at zipkin/src/main/java/zipkin2/DependencyLink.java:68

  }

  public static final class Builder {
    String parent, child;
    long callCount, errorCount;

    Builder() {
    }

    Builder(DependencyLink source) {
      this.parent = source.parent;
      this.child = source.child;
      this.callCount = source.callCount;
      this.errorCount = source.errorCount;
    }

    /** @see #parent() */
    public Builder parent(String parent) {
      if (parent == null) throw new NullPointerException("parent == null");
      this.parent = parent.toLowerCase(Locale.ROOT);
      return this;
    }

    /** @see #child() */
    public Builder child(String child) {
      if (child == null) throw new NullPointerException("child == null");
      this.child = child.toLowerCase(Locale.ROOT);
      return this;
    }

    /** @see #callCount() */
    public Builder callCount(long callCount) {
      this.callCount = callCount;
      return this;
    }

    /** @see #errorCount() */

View on GitHub (pinned to 878ce2a1fa)

Solutions

  1. Skip link creation when either service name is missing rather than passing null.
  2. Default to a placeholder name (e.g. "unknown") only if your downstream consumers tolerate it.
  3. Fix the upstream extraction so parent/child names are always resolved before building the link.

Example fix

// before
linkBuilder.parent(map.get("parent")); // null when key absent

// after
String parent = map.get("parent");
if (parent != null) linkBuilder.parent(parent);
Defensive patterns

Strategy: validation

Validate before calling

if (parentName == null || childName == null) return; // skip incomplete link
DependencyLink.newBuilder().parent(parentName).child(childName).build();

Prevention

When it happens

Trigger: Calling DependencyLink.newBuilder().parent(null), typically with a value derived from a map lookup or client/server span parsing that found no service name.

Common situations: Building dependency links from raw spans where the server side has no localEndpoint.serviceName; aggregating links from external sources where one side is missing.

Related errors


AI-assisted analysis of openzipkin/zipkin@878ce2a1fa (2026-08-14). Data as JSON: /api/errors/c06101afa13471d8. Report an issue: GitHub.