Entry Point Script Validation Error Reference

The following table describes validation errors that can occur when you upload an entry point script, create a script record, or attach a client script to a custom form. Some errors can also be returned when you edit a script file that has already been uploaded to NetSuite, attached to a script record, or attached to a custom form.

Error Code

Error Text (Description)

CANNOT_CHANGE_API_VERSION

This file is used by a SuiteScript {1} script; you cannot change the API version of the file.

{1} — SuiteScript version (1.0, 2.0, etc).

FAILED_TO_VALIDATE_SCRIPT_FILE

Failed to validate script file: {1}

{1} — the script file name.

INVALID_API_VERSION

Invalid JSDoc tag value; valid values are: @NApiVersion [2.X, 2.x, 2.0 2.1]

INVALID_JSDOC_TAG_VALUE

Invalid JSDoc tag value; valid values are: {1}

{1} — the valid values based on the specific invalid JSDoc tag.

MISSING_SCRIPT_TYPE

The @NScriptType JSDoc tag is required for 2.0 entry point scripts.

MULTIPLE_DEFINE_CALLS

Invalid define call, define should only be called one time per module. Define calls found at the following line numbers: {1}

{1} — the lines in the script file.

SCRIPT_OF_API_VERSION_20_CANNOT_IMPLEMENT_MORE_THAN_ONE_SCRIPT_TYPE_INTERFACES

(See SCRIPT_OF_API_VERSION_20_CANNOT ...)

SuiteScript 2.0 entry point scripts cannot implement functions for more than one script type.

SCRIPT_OF_API_VERSION_20_MUST_IMPLEMENT_A_SCRIPT_TYPE_INTERFACE

(See SCRIPT_OF_API_VERSION_20_MUST ....)

SuiteScript 2.0 entry point scripts must implement one script type function.

SS_V2_FILE_USED_FOR_FORM_SCRIPTS_MUST_IMPLEMENT_CLIENT_SCRIPT_TYPE

(See SS_V2_FILE_USED_FOR_FORM_SCRIPTS)

SuiteScript version 2 file used for form scripts must implement client script type.

SYNTAX_ERROR

Syntax error: {1}

{1} — additional information specific to the error.

THE_FILE_IS_USED_AS_SCRIPT_TYPE_1_CANNOT_BE_CHANGED_TO_2

(See THE_FILE_IS_USED_AS_SCRIPT_TYPE_1 ...)

The file is used as script type {1}, cannot be changed to {2}

{1} and {2} — the script types.

WRONG_SCRIPT_TYPE

Script file includes @NScriptType {1}; this script type cannot be used to {2}.

{1} — the script type specified; {2} — the script’s entry points.

CANNOT_CHANGE_API_VERSION

Full Error Text:

This file is used by a SuiteScript {1} script; you cannot change the API version of the file.

{1} — the SuiteScript version (that is, 1.0, 2.0, etc).

Occurs:

This error occurs when you edit a script file that is already attached to a script record or a custom form. Specifically, if you try to edit and save changes to the @NApiVersion JSDoc tag value.

For example, you'll see this error if you try to remove the @NApiVersion 2.0 JSDoc tag from a version 2.0 script.

Or, if you try to add the @NApiVersion 2.0 JSDoc tag to a version 1.0 script, you'll see this error.

Correction:

Other Notes:

In some cases, this error is preceded by the INVALID_API_VERSION error, which is included if the new @NApiVersion JSDoc tag value you are trying to use is invalid.

Note that SuiteScript 1.0 files don't use the @NApiVersion JSDoc tag. If you are still using SuiteScript 1.0 scripts, you should consider converting them to SuiteScript 2.0 or SuiteScript 2.1.

For help creating and uploading SuiteScript 1.0 files, see the Running Scripts in NetSuite Overview topic in the SuiteScript 1.0 Documentation topic.

FAILED_TO_VALIDATE_SCRIPT_FILE

Full Error Text:

Failed to validate script file: {1}

{1} — the script file name.

Occurs:

This error occurs if your script file isn't structured correctly. For example, you'll see this error if your script is formatted correctly for SuiteScript 2.0 in all ways except that it is missing the @NApiVersion JSDoc tag.

This error may also be displayed if you don't correctly initialize global variables, as described in Resolve Error:"SuiteScriptModuleLoaderError FAIL_TO_EVALUATE_SCRIPT_1 All SuiteScript API Modules are unavailable while executing your define callback" when Saving SuiteScript 2.0 File

Correction:

Check your script file to make sure that it contains all required elements and is structured correctly.

Other Notes:

For more information about creating valid scripts, see SuiteScript 2.x Entry Point Script Validation.

INVALID_API_VERSION

Full Error Text:

Invalid JSDoc tag value; valid values are: @NApiVersion [2.X, 2.x, 2.0, 2.1]

Occurs:

This error occurs when you try to upload a script file with an invalid @NApiVersion JSDoc tag value. It can also be displayed if you try to modify the value of the @NApiVersion JSDoc tag in a script file that has already been uploaded.

Correction:

Check your script file to make sure the @NApiVersion JSDoc tag has a valid value. Valid values are: 2.0, 2.x, and 2.X. 2.x and 2.X are equivalent.

Other Notes:

For more information about the @NApiVersion JSDoc tag values, see SuiteScript 2.x JSDoc Tags.

INVALID_JSDOC_TAG_VALUE

Full Error Text:

Invalid JSDoc tag value; valid values are: {1}

{1} — the valid values based on the specific invalid JSDoc tag.

Occurs:

This error occurs if your script file uses an invalid value for any JSDoc tag.

Correction:

Check your script file to make sure the value you used for the JSDoc tag is valid. Verify that it doesn't include typos or other errors.

Other Notes:

For more information about JSDoc tag values, see SuiteScript 2.x JSDoc Tags.

MULTIPLE_DEFINE_CALLS

Full Error Text:

Invalid define call, define should only be called one time per module. Define calls found at the following line numbers: {1}

{1} — the lines in the script file where the define calls are.

Occurs:

This error occurs if your script includes more than one define statement. Each script can have only one define statement.

Correction:

Check your script file to make sure there is only one define statement, and rework it if multiple defines statements are in your script.

Other Notes:

For more information about using define calls, see define Object.

MISSING_SCRIPT_TYPE

Full Error Text:

@NScriptType is required for 2.0 entry point script

Occurs:

This error occurs if you try to create a script record for a SuiteScript 2.x script that doesn't include the @NScriptType JSDoc tag.

This error also occurs if you remove the @NScriptType JSDoc tag from a script file that is attached to a script record.

Correction:

Edit the script file and add the @NScriptType JSDoc tag with the appropriate value. Also, don't remove the @NScriptType JSDoc tag from any script file that is already attached to a script record.

Other Notes:

This error occurs when you create a script record for your script file. You'll be able to successfully upload your script file to the File Cabinet, but you won't be able to create a script record for it. In this case, successfully uploading a script file doesn't mean that the file is valid.

SCRIPT_OF_API_VERSION_20_CANNOT ...

Full Error Text:

SuiteScript 2.0 entry point scripts cannot implement functions for more than one script type.

The full code for this error is: SCRIPT_OF_API_VERSION_20_CANNOT_IMPLEMENT_MORE_THAN_ONE_SCRIT_TYPE_ INTERFACES

Occurs:

This error occurs if the interface (a return statement) of your script file includes entry points from more than one script type.

Correction:

Check your script to make sure the interface contains only entry points for one script type (the script type indicated in the @NScriptType JSDoc tag). If necessary, create additional script files to implement addition script type entry points.

Other Notes:

For a description of all entry points for each script type, see SuiteScript 2.x Script Types.

SCRIPT_OF_API_VERSION_20_MUST ...

Full Error Text:

SuiteScript 2.0 entry point scripts must implement one script type function.

The full error code for this error is: SCRIPT_OF_API_VERSION_20_MUST_IMPLEMENT_A_SCRIPT_TYPE_INTERFACE.

Occurs:

This error occurs when your script is missing an interface (a return statement) or that an error exists within the interface. This error can occur when you try to upload a file, or when you try to edit a file that was previously uploaded.

Correction:

Check your script file to make sure that at least one entry point for the script type (as indicated in the @NScriptType JSDoc tag) is included in the interface.

Other Notes:

For a description of all entry points for each script type, see SuiteScript 2.x Script Types.

SS_V2_FILE_USED_FOR_FORM_SCRIPTS

Full Error Text:

SuiteScript 2.0 file used for form scripts must implement client script type.

The full error code for this error is: SS_V2_FILE_USED_FOR_FORM_SCRIPTS_MUST_IMPLEMENT_CLIENT_SCRIPT_TYPE.

Occurs:

This error occurs if you try to attach a script type other than a client script to a custom form. Only a client script can be attached to a form (that is, deployed at the form level). All other types of entry point scripts can only be deployed at the record level.

Correction:

Make sure that the script you are attempting to attach to a custom form is a client script. Otherwise, deploy the script at the record level.

Other Notes:

For more information about working with client scripts on custom form, see SuiteScript 2.x Form-Level Script Deployments. For more information about deploying other types of entry point scripts at the record level, see SuiteScript 2.x Record-Level Script Deployments.

SYNTAX_ERROR

Full Error Text:

Syntax error: {1}

{1} — additional information specific to the error.

Occurs:

This error occurs if your script contains JavaScript syntax errors.

Correction:

Check to make sure your script follows all JavaScript syntax rules.

Other Notes:

There are several resources available for JavaScript syntax rules including two JavaScript tutorial sites at: https://www.w3schools.com/js/default.asp and https://developer.mozilla.org/en-US/docs/Web/JavaScript.

THE_FILE_IS_USED_AS_SCRIPT_TYPE_1 ...

Full Error Text:

The file is used as script type {1}, cannot be changed to {2}.

{1} and {2} — the script types.

The full error code for this error is: THE_FILE_IS_USED_AS_SCRIPT_TYPE_1_CANNOT_BE_CHANGED_TO_2.

Occurs:

This error may occur if you edit a script file that is attached to an existing script record to use a different script type interface from what it previously used, and a different @NScriptType value.

Correction:

To avoid this error, make your changes in a script file that isn't already associated with a script record. Then create a new script record based on the updated script file.

Other Notes:

WRONG_SCRIPT_TYPE

Full Error Text:

Script file includes @NScriptType {1}; this script type cannot be used to {2}

{1} — the script type specified; {2} — the script’s entry points.

Occurs:

This error occurs if the @NScriptType JSDoc tag value isn't compatible with the entry points in the script’s interface.

Correction:

Check your script to make sure the @NScriptType JSDoc tag value corresponds to the entry points in the script. If the tag’s value doesn't correspond to the script type interface, you cannot upload the file to the File Cabinet.

Other Notes:

For more information about script types, their definitions, and entry points, see SuiteScript 2.x Script Types.

Related Topics

General Notices