{"record":{"id":"c06101afa13471d8","repo":"openzipkin/zipkin","slug":"parent-null","errorCode":null,"errorMessage":"parent == null","messagePattern":"parent == null","errorType":"exception","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"zipkin/src/main/java/zipkin2/DependencyLink.java","lineNumber":68,"sourceCode":"  }\n\n  public static final class Builder {\n    String parent, child;\n    long callCount, errorCount;\n\n    Builder() {\n    }\n\n    Builder(DependencyLink source) {\n      this.parent = source.parent;\n      this.child = source.child;\n      this.callCount = source.callCount;\n      this.errorCount = source.errorCount;\n    }\n\n    /** @see #parent() */\n    public Builder parent(String parent) {\n      if (parent == null) throw new NullPointerException(\"parent == null\");\n      this.parent = parent.toLowerCase(Locale.ROOT);\n      return this;\n    }\n\n    /** @see #child() */\n    public Builder child(String child) {\n      if (child == null) throw new NullPointerException(\"child == null\");\n      this.child = child.toLowerCase(Locale.ROOT);\n      return this;\n    }\n\n    /** @see #callCount() */\n    public Builder callCount(long callCount) {\n      this.callCount = callCount;\n      return this;\n    }\n\n    /** @see #errorCount() */","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/openzipkin/zipkin/blob/878ce2a1fad54ca941d17fdcf2e1d924b148eb1f/zipkin/src/main/java/zipkin2/DependencyLink.java#L50-L86","documentation":"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.","triggerScenarios":"Calling DependencyLink.newBuilder().parent(null), typically with a value derived from a map lookup or client/server span parsing that found no service name.","commonSituations":"Building dependency links from raw spans where the server side has no localEndpoint.serviceName; aggregating links from external sources where one side is missing.","solutions":["Skip link creation when either service name is missing rather than passing null.","Default to a placeholder name (e.g. \"unknown\") only if your downstream consumers tolerate it.","Fix the upstream extraction so parent/child names are always resolved before building the link."],"exampleFix":"// before\nlinkBuilder.parent(map.get(\"parent\")); // null when key absent\n\n// after\nString parent = map.get(\"parent\");\nif (parent != null) linkBuilder.parent(parent);","handlingStrategy":"validation","validationCode":"if (parentName == null || childName == null) return; // skip incomplete link\nDependencyLink.newBuilder().parent(parentName).child(childName).build();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Resolve both endpoint names before building links","Ensure spans you aggregate from carry localEndpoint.serviceName"],"tags":["core","dependency-link","null-pointer","builder","validation"],"backgroundTag":null,"analyzedSha":"878ce2a1fad54ca941d17fdcf2e1d924b148eb1f","analyzedAt":"2026-08-14T15:17:09.895Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}