InstallShield 2014 » InstallScript Language Reference

Project: This information applies to the following project types:

InstallScript MSI

FeatureError does not return error information for unsupported functions. For example, ComponentInitialize, ComponentUpdate, and ComponentValidate are not supported as feature functions. FeatureError does not work for these functions.

The FeatureError function obtains additional error information when a feature function returns a value less than zero. The following code fragment shows a typical implementation of FeatureError:

nResult = FeatureGetData (MEDIA, svFeature, FEATURE_FIELD_SELECTED, nvResult,



if(nResult < 0) then

    FeatureError(svFeatureSource, svFeature, svComponent, svFile, nvError);


    SprintfBox (INFORMATION, "FeatureGetData Error Information",

               "FeatureGetData had the following error:\n\n" +

               "Media Name: %s\nFeature: %s\nComponent: %s\n" +

               "File: %s\nError Number: %ld"

               svFeatureSource, svFeature, svComponent, svFile, nvError);


The FeatureError function should be called only after another feature function returns a value less than zero. FeatureError might return invalid error codes if called when another feature function has not returned a value that is less than zero.

Note: FeatureError returns information for all parameters (media name, feature name, component name, file name, and error code) only for script-created feature sets. For features in the file media (MEDIA), FeatureError returns only the error code.


FeatureError ( svFeatureSource, svFeature, svComponent, svFile, nvError );


FeatureError Parameters




Returns the media name of the script-created feature set if relevant to the error indicated by nvError.


Returns the name of the feature if relevant to the error indicated by nvError.


Returns the name of the component if relevant to the error indicated by nvError.


Returns the name of the file if relevant to the error indicated by nvError.


Returns a code that identifies the type of error that occurred in a previous call to a feature-related function. These error codes are described below.

Error Codes

The following table describes the error codes returned by FeatureError.

Note: After correcting errors involving the media, you must rebuild the project.

FeatureError Error Codes





Cannot add feature.

FeatureAddItem was unable to add a feature to the script-created feature set.


Specified feature already exists.

FeatureAddItem was called twice with the same media name and feature name.


Specified feature cannot be selected or deselected.

FeatureSelectItem was used to select or deselect a feature that is required by a currently selected feature. Deselect the dependent feature (that requires the other feature) before attempting to select or deselect the required feature.


Specified feature cannot be found in the media.

An attempt was made to access a feature that does not exist. This error occurs when a feature name is specified incorrectly in a feature function call. Feature names must be specified exactly as they appear in the Setup Design view or in the call to FeatureAddItem. Feature names are case-sensitive.


Out of disk space.

The target disk or directory has insufficient free space, the disk space cannot be determined because TARGETDIR (in an InstallScript installation) or INSTALLDIR (in an InstallScript MSI installation) is invalid, or a script-defined folder of a feature has not been set.


Attempted operation not allowed with script-created feature sets.

A script-created feature set name was passed to a feature function that operates only on file media.


The list specified in the feature function is not valid.

When calling FeatureListItems, verify that the list you are passing to the function is valid.


Attempted operation not allowed with file media library.

A file media name was passed to a feature function (for example, FeatureAddItem), that operates only on script-created feature sets.


The specified media cannot be found.

The media has been declared, but it not associated with any features. Make sure that script-created features are associated with the media.


Unable to allocate memory.

Insufficient memory is available to the setup. Display a message to the end user to close all other applications or to cancel the setup, reboot the system, and restart the setup.


Specified option is not valid.

An invalid option has been specified for a feature function—for example, specifying only a component when both a component and file name are required.


Invalid value passed to a feature-related function.

One of the values passed to a feature function is invalid. This error can be caused, for example, by passing an empty string in the second parameter of FeatureAddItem.

Return Values

FeatureError Return Values

Return Value



FeatureError was successful.

< 0

FeatureError failed.

See Also