{
  "slug": "isa-segment-must-be-106-characters",
  "title": "The ISA header is fixed-width: 106 characters, no exceptions",
  "description": "Most X12 segments are delimited. ISA is not — every element has an exact width and must be padded. One character out and the receiver's parser fails before reading anything.",
  "keywords": [
    "isa segment",
    "isa 106 characters",
    "x12 envelope",
    "isa padding",
    "edi translator error"
  ],
  "cause": [
    "ISA is the one X12 segment parsed positionally rather than by delimiter, because it is what tells the receiver which delimiters the rest of the file uses.",
    "Sixteen elements with fixed widths — 2, 10, 2, 10, 2, 15, 2, 15, 6, 4, 1, 5, 9, 1, 1, 1 — space-padded to size. With the tag and separators that is exactly 105 characters, plus the segment terminator: 106.",
    "A sender ID shorter than 15 characters that is not padded shifts every subsequent element left. The receiver reads the delimiter from the wrong offset and rejects the interchange without a useful error, because it could not get far enough to produce one."
  ],
  "example": {
    "label": "Generate an envelope with correct padding and verify the length",
    "curl": "curl -sX POST https://fluentedi.com/v1/edi/build -H 'content-type: application/json' \\\n  -d '{\"document\":\"856\",\"data\":{\"orders\":[{\"po_number\":\"P1\",\"packs\":[{\"sscc\":\"006141411234567890\",\"items\":[{\"upc\":\"012345678905\",\"quantity\":5}]}]}]}}'",
    "output": "\"isa_length\": 106,\n\"isa_length_valid\": true,\n\"control_numbers\": {\n  \"interchange\": \"000000001\", \"group\": \"1\", \"transaction_set\": \"0001\"\n}"
  },
  "fix": [
    "Never assemble ISA by string concatenation. Pad each element to its declared width, including the trailing spaces nobody can see.",
    "Check the length is 106 before sending. It is a single assertion that catches an entire class of failure.",
    "The authorisation and security fields (ISA02, ISA04) are usually ten spaces, not empty — omitting them shortens the header."
  ],
  "tools": [
    "https://fluentedi.com/v1/edi/build",
    "https://fluentedi.com/v1/edi/validate",
    "https://fluentedi.com/v1/edi/parse"
  ]
}