This error is the equivalent of a null reference expression in ArcScript, and indicates that a formatter is applied to an attr that has not been defined in the script that you are working with.
The attr that begins the expression is the value that is undefined, such as foo here:
[myitem.foo | add()]
Or an attr in a named class like the _map item:
[_map.foo | add()]
There are two ways to address this.
Initialize your attrs:
You can initialize this attr in an earlier portion of the connector where your script is being executed. If you are using ArcScript, this would be:
<arc:set attr="myitem.foo" value="" />
Using variables in an XML Map, you can simply set the new value:
Later, when you resolve the attr, the value returned will be the initialized value (even if set to an empty string) when not otherwise set
Use the def (default) formatter to use a default value if the attr is undefined
If you are reading the value of an attr, and you are not sure if it has been initialized, you can use the def formatter to use a value to apply if undefined:
<arc:set attr="myitem.loopCount" value="[myitem.loopCount | def(0) | add(1)]" />
In this example, the first time loopCount is resolved, it is set to 0 if undefined (and 1 is added).
If no argument is provided to def, an empty string will be used:
[myitem.foo | def]
Resolves to an empty string when foo is undefined here.