Print this page

Why do I receive the error ServletResponse is no longer valid: setHeader: [] when installing or upgrading a managed package?

Knowledge Article Number 000175145
Description Occasionally, errors encountered during the installation of packages are not descriptive of the cause of failure, when the cause can be something trivial that a Developer or System Administrator can resolve.  Missing data or class dependencies, custom validation rules and workflows or unique org settings could interfere with installation, causing it to fail, but Salesforce has not reported the cause in a more humane manner.

One such error recorded has been:

System.DmlException: Insert failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, java.lang.IllegalStateException: ServletResponse is no longer valid: setHeader: []

This error occurred when performing as DML operation in a test method during installation.  The error could only be reproduced in this one demo org.
Resolution In this instance, a workflow relating to the object on which the DML operation was being performed was identified, deleted, and the installation could be completed.

In such instances, try to find what is unique to this org compared to similar orgs - dev orgs, trial orgs, sandboxes - and remove as a process of elimination.

promote demote