Authentication Manager Bulk Admin (AMBA) script fails to run with “Invalid header field name” error
2 years ago
Originally Published: 2023-10-04
Article Number
000068363
Applies To
RSA Product Set: SecurID
RSA Product/Service Type: Authentication Manager, Authentication Manager Bulk Admin, AMBA
RSA Version/Condition: 8.x
Issue
When attempting to run an AMBA script, the job will fail almost immediately.  The log file will show an error like the following:

rsaadmin@am87-1:/opt/rsa/am/amba> more logfile.log
BOJ    : 2023-10-03 19:27:22 - 8.7.1.0.0 (1433590) - Input = input.csv
Error  : 2023-10-03 19:27:22 : Line                                     -Invalid  header field name:
Info   :                                                                -Exit code: 1
EOJ    : 2023-10-03 19:27:22 - Terminating


Note that it does not call out the line number.  The header row appears fine when viewed in Excel.  Customers have reported that this error does not occur if the file is less than 4000 lines, but longer versions will generate this error.
 
Cause
Excel is great at generating and manipulating CSV files like they were spreadsheets, but at the end of the day they are still just text files.  Opening the CSV file in Notepad or Notepad++ shows the following:

Action,TokSerial,Operation,AttributeName,AttributeValue,,,,,,,,,,
CTA,123456789,Add,EITS Asset Tag Number,P123456,,,,,,,,,,
CTA,123456790,Add,EITS Asset Tag Number,P123457,,,,,,,,,,
CTA,123456791,Add,EITS Asset Tag Number,P123458,,,,,,,,,,
CTA,123456792,Add,EITS Asset Tag Number,P123459,,,,,,,,,,


Note there are ten commas at the end of every line.  Excel is very bad about leaving remnants behind when you delete data from columns in CSV files.  This is where these extra commas come from.
 
Resolution
To correct the issue, in Windows:
  1. Open the CSV file in Notepad or Notepad++.  
  2. Type Ctrl+H to bring up the Replace menu.  
  3. In the Find field, put in the same number of commas as in the CSV file, and leave the Replace field blank:
  1. Click Replace All to delete all the trailing commas from your CSV file.  
  2. Save the file and use it to replace the original file on the Primary.
For Linux
  1. Open the CSV file on the Primary using vi or vim, and then run the following command:
     
%s/,,,,,,,,,,//g
 
  1. Save the file with [ESC]:wq! to keep the changes.  
Workaround
Ensure that if you remove columns from a CSV file in Excel, that you delete the entire column, and do not just delete the data from the column.  This is the underlying cause of the extra commas.
​​​​​​
Notes
There is no practical limit to the size of a CSV file that AMBA can use.  We have scripts with one million lines to add test users to the internal database; the script takes about 11 hours to finish but the system never complains.