ID 158140 - MergeExpression/Expression node errors on command line render when exr channel information is referenced in expression (Nothing named '...')

Follow

Problem summary
A Nuke script that contains an expression node which references a custom channel in an EXR file (e.g. channels rgba  = __globalMatte.red) will render fine in the GUI, but when rendering from the command line, the output isn't correct and an error appears:
 
ERROR: Expression.expr0: Nothing is named ''__globalMatte.red'
 
Customer reported version
Nuke 9.0v8
 
Customer reported platform
Linux
 
Steps to reproduce
 
1) Read in an EXR file that contains custom channels (see attached example script).

2) Add an Expression node with an expression that references one of the custom channels.
 


3) Add a Write node and render the first frame - no errors appear.
 
4) Save the script and render the first frame from the command line -  the expression gives an error and the render will be incorrect.
 
ERROR: Expression.expr0: Nothing is named ''__globalMatte.red'
 
Reproduced by support
Reproduced in Nuke 9.0v8, 10.0v3 on Windows 7
Nuke7.0v1 - 9.0v5 MacOS & Windows
 
Expected behaviour
The script should render correctly in terminal mode just like in the GUI.
 
Actual behaviour
An error appears and the renders are incorrect.

    We're sorry to hear that

    Please tell us why