There are limits to the SKILL commands that are usable in pcells. They include the basic SKILL operators, the db, tech, rod, pc and cdf commands. These command prefixes are documented in one of the pcell documents. These commands are available in all tool contexts. Other command prefixes such as xl and le are only available in interactive tool contexts. You may be using some of those in your pcell custom code.
Generating GDS2 from batch means that you do not have access to the interactive commands as they are not loaded. Check your SKILL for these commands. You may also get an idea of which command from the error message or from the log file. Search for it and replace it.