Partial Reads, Character Encoding, and SFTP Mailbox Fixes
Adrian Duyzer
Inbound EDI that the parser stops reading part-way through now fails instead of being delivered as a partial document, accented characters now survive SFTP ingest instead of being deleted, and a file lost from a consume-on-read SFTP mailbox now produces an error instead of a log warning.
Impact: some inbound documents that used to be delivered will now fail. Those deliveries were missing everything after the point where reading stopped, and nothing marked them as incomplete. If you have an error webhook or error emails set up, failures of this kind start with Stopped reading at line. Partners who send Latin-1 or Windows-1252 over SFTP will now have their accented characters in the JSON, with a non_utf8_encoding warning on each transaction. Nobody has to change any configuration.
Documents the parser stops reading part-way through:
- When the parser reached something it could not read, such as a segment cut off without its terminator or a segment ID that is lowercase, four characters long, or part of a log line spliced into the file, Tediware delivered what it had read up to that point as the whole document. Every later transaction set, group and interchange in the file was dropped.
- These documents now fail. The error names the position in the file as you received it, the reason, and how many segments were not translated, in this form:
Stopped reading at line 14, column 1: found a segment that does not start with a valid segment ID. 23 segments from there on were not translated.
- The three reasons are
found an empty segment,found a segment that does not start with a valid segment ID, andthe file ended partway through a segment. - Where nothing can be lost, Tediware repairs the text before reading it and the document translates in full. A final IEA with no terminator gets one. An empty segment (two terminators with nothing but spaces between them) is removed, and so are spaces before a segment ID. The last two repairs are logged as a warning on the trace, with the line of the first one.
- Two interchanges in one file, where the first IEA had no terminator, used to lose the second interchange without any error. Both are now read.
- On automatic 997s, the transaction set where reading stops is now rejected with AK502 code 5 instead of accepted. Sets after it in the same file are still acknowledged. An empty segment no longer throws off the SE01 segment count in the 997.
- The EDI Inspector still shows everything it could read, and marks where an empty segment was removed with a notice.
- Parsing now stops after 5,000 rejected segments, with an error that gives the count and the first rejected segment’s ID, line, column and reason. A file that pairs a supported transaction set with a large unsupported one (above roughly 1,250 line items) used to translate the supported set and drop the other; that file now fails as a whole.
Character encoding:
- SFTP ingest deleted every byte above ASCII, so
SÉRIEreached the translation asSRIE. SFTP now keeps those characters, as AS2 and the API already did. - A document that is not valid UTF-8 is read byte by byte: valid UTF-8 sequences as UTF-8, and any other byte as Windows-1252, which covers Latin-1. The document processes as usual, and each transaction set carries a
non_utf8_encodingwarning whosedetail.encodingisWindows-1252. This applies to SFTP, AS2, MCP submission and file upload in the app. The HTTP API already rejects invalid UTF-8 with a 400. - If accented characters from a partner still come out wrong after this, the partner is sending some encoding other than UTF-8 or Windows-1252.
- The parser still drops characters outside the X12 basic and extended character sets, such as Ø, ß, € and CJK text, without a warning. That fix is still to come.
SFTP mailboxes that remove a file once it is read (ECGrid among them):
- If a fetch stopped while a file was downloading, for example because the connection dropped, the file could be gone from the mailbox before Tediware had it, and the only record was a log warning saying it would be fetched next time.
- Tediware now records each file it starts downloading. On the next poll it checks whether that file is still listed. If it is, it is fetched as usual. If it is not, Tediware saves an error result on the flow that was fetching it, naming the file, the directory, the connection and the time the fetch stopped. The error reaches the flow’s error handler, the error webhook and the error emails.
- To recover the file, reset its download in your mailbox provider’s portal so it reappears in the directory, or ask the sender to resend it.
- The SFTP connection test used to download up to ten inbound files to prove the directory was readable, which removed real files from these mailboxes. It now lists the directory without downloading anything.
Other changes:
- Log entries from
GET /platform/logs,GET /platform/traces/:traceGuidand the MCPtransaction_logstool now includeresultId, the result the entry concerns, ornullwhen there is none. The entry a failed step writes also carrieserrors, the first 50 itemized findings (one per violation for implementation validation). The full list is in the failed result’sdetail.errors. - The webhook docs now say what
resultIdpoints at for each slot. An outbound delivery points at the SFTP upload or AS2 send result, and an error delivery points at the failed result. Each webhook signs with its own secret, so give each webhook its own URL; a distinct path or query string is enough. - Developer-tier usage is now counted per UTC calendar month. Before this, the usage period never rolled over after an organization’s first one, so later usage was not counted and the 800-transaction limit and its emails did not fire. Organizations on the Developer tier that reach 800 transactions in a month will now stop processing until the 1st of the next month, UTC.
The full list of transaction warning codes is in the EDI Transactions API docs, and the mailbox recovery steps are in the connections docs. Questions go to adrian@tediware.com.
This update was written with AI assistance. It has been reviewed and edited by a human.