{
  "slug": "856-asn-rejected-hl-hierarchy",
  "title": "Why an 856 ASN is rejected for HL hierarchy errors",
  "description": "The HL loop flattens a shipment's tree into a list, and every level must name the ID its parent was actually given. Here is what breaks, and how to see it before the retailer does.",
  "keywords": [
    "856 hl segment",
    "asn rejected",
    "hl loop error",
    "orphan parent",
    "edi 856 hierarchy",
    "hl02"
  ],
  "cause": [
    "An 856 describes a shipment as a tree — shipment, then order, then pack, then item — but X12 has no nesting. The HL loop encodes the tree as a flat list where HL01 is this node's ID and HL02 is its parent's ID.",
    "That means the sender is doing pointer bookkeeping by hand. On a single-carton shipment it is obvious. On four orders across nine cartons with mixed SKUs, a parent ID gets written that no HL segment ever claims, and nothing local complains: the file is still well-formed X12.",
    "The receiver's translator rejects it, usually with AK3 code 7 (segment out of sequence) or a partner-specific chargeback. By then the truck has left."
  ],
  "example": {
    "label": "An ASN whose second HL names a parent that does not exist",
    "curl": "curl -sX POST https://fluentedi.com/v1/edi/validate -H 'content-type: application/json' \\\n  -d '{\"input\":\"ST*856*0001~BSN*00*S1*20260824*1200*0001~HL*1**S*1~HL*2*9*O~SE*5*0001~\"}'",
    "output": "\"valid\": false,\n\"errors\": [\n  {\n    \"segment\": \"HL02=9\",\n    \"check\": \"orphan_parent\",\n    \"message\": \"HL 2 names parent \\\"9\\\", but no HL segment has that ID.\n                This is the most common cause of an ASN rejection.\"\n  }\n]"
  },
  "fix": [
    "Do not write HL identifiers by hand. Assign them during the walk so a child records the ID its parent actually received, rather than one predicted in advance.",
    "Validate before sending, with require_levels set to the structure your retailer mandates — a missing carton level passes generic X12 validation and still earns a chargeback.",
    "If you are generating the ASN from a packing manifest, use edi.build, which does the pointer bookkeeping and computes CTT01 and SE01 from what it emitted."
  ],
  "tools": [
    "https://fluentedi.com/v1/edi/validate",
    "https://fluentedi.com/v1/edi/build",
    "https://fluentedi.com/v1/edi/parse"
  ]
}