Running a job to a System Agent may generate an 'invalid AFM' error. Full error as shown in the transmitter.log would be:
MAIN STATE SUBERROR Failed SetEnd Status(Invalid AFM)
During a job run, the AFM will be modified to include environment settings defined in an environment file. Improper settings in the environment file will cause the AFM to become invalid.
Environment files as used by the the System Agent are meant to contain <variable> <setting> pairs. These are not shell scripts. Including anything in these files other than <variable> <setting> pairs will cause the AFM to be invalid.
This refers to the oscomponent.environment.variable* settings in the agentparm.txt file.
There may be other causes of this error.