Let me address all three aspects of your issue with a comprehensive solution:
First, regarding why the file passes validation before upload but fails after SFTP transfer: The validation you’re running is checking the file format structure (BAI2 compliance, record counts, field formats) but not the byte-level encoding details like line endings. When you upload manually through the UI, CloudSuite receives the file directly from your browser with its original line endings intact. The SFTP process, however, is modifying the file in transit.
Second, why it fails only after SFTP transfer: Your SFTP server is configured for ASCII transfer mode, which automatically converts line endings based on the operating system. Since your bank sends files from a Windows system (CRLF line endings) and your SFTP server is Linux-based, the transfer mode converts some but not all line endings to LF (Unix style). This creates mixed line endings in the file - some records have CRLF, others have just LF. CloudSuite’s BAI2 parser requires consistent line endings throughout the entire file for proper record delimiting.
Third, the solution without changing your import template: You have two options that don’t require modifying the template or your SFTP configuration:
Option A (Recommended): Enable preprocessing in CloudSuite. Navigate to Financial Management > Bank Reconciliation > Import Profiles. Edit your bank statement import profile and expand the Advanced Options section. Enable ‘Preprocess File’ and select ‘Normalize Line Endings to CRLF’. This tells the import utility to scan the entire file and standardize all line endings before parsing begins. Add this preprocessing rule:
preprocess.lineEndings=CRLF
preprocess.encoding=UTF-8
Option B: Create an intermediate processing step. On your SFTP server, set up a file watcher script that runs immediately after the bank file arrives but before CloudSuite’s scheduled import picks it up. The script should normalize line endings:
#!/bin/bash
dos2unix -n input.bai temp.bai
unix2dos -n temp.bai output.bai
This converts to Unix format then back to Windows format, ensuring consistent CRLF throughout. Point your CloudSuite import job to the output.bai file instead of the original.
I recommend Option A because it’s configuration-only and doesn’t require scripting or additional dependencies. After enabling preprocessing, test with tomorrow’s bank statement file. The import should succeed through SFTP just as it does with manual upload, and your daily bank reconciliation process will resume normally.