Javascript Run-Time Errors

Error # | Error Code
5000 | Cannot assign to 'this' You attempted to assign a value to this. this is a JScript keyword that refers to either: the object currently executing a method, the global object if there is no current method (or the method does not belong to any other object). A method is a JScript function that is invoked through an object. Inside a method, the this keyword is a reference to the object the method was invoked through (which happens to be the object created by invoking the class constructor with the new operator). Inside a method, you can use this to refer to the current object, but you cannot assign a new value to this. To correct this error Do not attempt to assign to this. To access a property or method of an instantiated object, use the dot operator (e.g., circle.radius). Note You cannot name a user-created variable this; it is a JScript reserved word.
5001 | <Item> is not a number; Number expected You attempted to invoke the Number.prototype.toString or Number.prototype.valueOf method on an object of a type other than Number. The object of this type of invocation must be of type Number. To correct this error Only invoke the Number.prototype.toString or Number.prototype.valueOf methods on objects of type Number.
5002 | <Item> is not a function; Function expected Either you attempted to invoke one of the Function prototype methods on an object that was not a Function object, or you used an object in a function call context. For example, the following code produces this error because example is not a function.
    var example = new Object();  // Create a new object called "example".
    var x = example();           // Try and call example as if it were a function.
To correct this error Only call Function prototype methods on Function objects. Ensure that you use the function call operator () to call functions only.
5003 | Cannot assign to a function result You attempted to invoke the Boolean.prototype.toString or Boolean.prototype.valueOf method on an object of a type other than Boolean. The object of this type of invocation must be of type Boolean. For example:
    var o = new Object;
    o.f = Boolean.prototype.toString;
    o.f();
To correct this error Only invoke the Boolean.prototype.toString or Boolean.prototype.valueOf methods on objects of type Boolean.
5004 | <Item> is not an indexable object; Cannot index object
5005 | <Item> is not a string; String expected You attempted to invoke the String.prototype.toString or String.prototype.valueOf method on an object of a type other than String. The object of this type of invocation must be of type String. To correct this error Only invoke the String.prototype.toString or String.prototype.valueOf methods on objects of type String.
5006 | <Item> is not a date object; Date object expected You attempted to invoke the Date.prototype.toString or Date.prototype.valueOf method on an object of a type other than Date. The object of this type of invocation must be of type Date. For example:
    var o = new Object;
    o.f = Date.prototype.toString;
    o.f();
To correct this error Only invoke the Date.prototype.toString or Date.prototype.valueOf methods on objects of type Date.
5007 | <Item> is not an object; Object expected You attempted to invoke the Object.prototype.toString or Object.prototype.valueOf method on an object of a type other than Object. The object of this type of invocation must be of type Object. To correct this error Only invoke the Object.prototype.toString or Object.prototype.valueOf methods on objects of type Object.
5008 | Cannot assign to <item>; Illegal assignment You attempted to assign a value to a read-only identifier. You cannot assign a value to a read-only identifier. For example, host defined objects and external COM objects. To correct this error Do not assign values to read-only identifiers.
5009 | <Item> is undefined; Undefined identifier You attempted to use an identifier that the JScript compiler does not recognize. The undefined value is returned whenever you use: a variable that does not exist, a variable that has been declared, but never had a value assigned to it, an object property that does not exist. To correct this error Declare the variable with a var statement (as in var x;).
5010 | <Item> is not a boolean; Boolean expected You attempted to invoke the Boolean.prototype.toString or Boolean.prototype.valueOf method on an object of a type other than Boolean. The object of this type of invocation must be of type Boolean. For example:
    var o = new Object;
    o.f = Boolean.prototype.toString;
    o.f();
To correct this error Only invoke the Boolean.prototype.toString or Boolean.prototype.valueOf methods on objects of type Boolean.
5011 | Can't execute code from a freed script
5012 | Cannot delete <item>; Object member expected You attempted to perform an operation on an object's data member, but the member does not exist. To correct this error Ensure you typed the name of the data member correctly.
5013 | <Item> is not a VBArray; VBArray expected You supplied an object that was not a Visual Basic safeArray, when one was expected.
    new VBArray(safeArray);
VBArrays are read-only, and cannot be created directly. The safeArray argument is a VBArray value, and must have obtained a VBArray value before being passed to the VBArray constructor. This can only be done by retrieving the value from an existing ActiveX or other object. To correct this error Ensure you pass only VBArray objects to the VBArray constructor.
5014 | <Item> is not a JScript object; JScript object expected You attempted to pass a non-JScript object to a built-in function that expects a JScript object. Various built-in functions require objects defined in JScript (as opposed to objects defined by the host, or an external component like a control). To correct this error Ensure that the object you are passing in as a parameter is of the correct type.
5015 | <Item> is not an enumerator object; Enumerator object expected You attempted to invoke the Enumerator.prototype.atEnd, Enumerator.prototype.item, Enumerator.prototype.moveFirst, or Enumerator.prototype.moveNext method on an object of a type other than Enumerator. The object of this type of invocation must be of type Enumerator. Here is an example of code that breaks this rule:
    var o = new Object;
    o.f = Enumerator.prototype.atEnd;
    o.f();
To correct this error Only invoke the Enumerator.prototype.atEnd, Enumerator.prototype.item, Enumerator.prototype.moveFirst, or Enumerator.prototype.moveNext methods on objects of type Enumerator. To find out if your object is an Enumerator object, use:
    if(x instanceof Enumerator)
5016 | <Item> is not a regular expression object; Regular Expression object expected You attempted to invoke the RegExp.prototype.toString or RegExp.prototype.valueOf method on an object of a type other than RegExp. The object of this type of invocation must be of type RegExp. To correct this error Only invoke the RegExp.prototype.toString or RegExp.prototype.valueOf methods on objects of type RegExp.
5017 | Syntax error in regular expression The structure of your search string violates one or more of the grammatical rules of a JScript regular expression. To correct this error Ensure the structure of your regular expression search string adheres to the JScript regular expression syntax.
5018 | Unexpected quantifier When composing your regular expression search pattern, you created a pattern element with an illegal repetition factor. For example, the pattern
    /^+/
is illegal because the element ^ (beginning of input) cannot have a repetition factor. The following table lists the elements that cannot have repetition factors.
Element | Description
--- | ---
^ | Beginning of input
$ | End of input
\b | Word boundary
\B | Non-word boundary
* | Zero or more repetitions
+ | One or more repetitions
? | Zero or one repetitions
{n} | n repetitions
{n,} | n or more repetitions
{n,m} | From n to m repetitions, inclusive
To correct this error Ensure your search pattern element contains legal repetition factors only.
5019 | Expected ']' in regular expression You attempted to create a character class for a regular expression match, but did not include the right bracket. Individual literal character combinations can be assembled into character classes by placing them within brackets. A character class matches any one character it contains. For example, /[abc]/ matches any one of the letters "a", "b", or "c". To correct this error Add the right bracket to the regular expression. Note If you want to match a single bracket, escape it with a backslash - \[ - so it is not interpreted as a special character by JScript.
5020 | Expected ')' in regular expression You attempted to create a regular expression capture, assertion, or group, but did not include the closing parenthesis. Parentheses have several purposes in regular expressions. Primarily, they are used to capture sub-expressions, to specify assertions, or to group patterns together so that the items can be treated as a single unit by *, +, ?, and so on. To correct this error Add the rightmost closing parentheses. Note If you want to match a single parenthesis, escape it with a backslash - \( - so that it is not interpreted as a special character by JScript.
5021 | Invalid range in character set You attempted to create a regular expression with an invalid character set range. Character sets must range from single characters only, such as a-z or 0-9; you cannot include character classes such as \w in a character set. The first character in the range must also come before the second character in the range. For example:
    var good = /[a-z]/;     // A valid character range - a comes before z.
    var notGood = /[z-a]/;  // An invalid character range - z does not come before a.
To correct this error Use only single characters to compose your regular expression character set, and make sure they are in the correct order.
5022 | Exception thrown and not caught You included a throw statement in your code, but it was not enclosed within a try block, or there was no associated catch block to trap the error. Exceptions are thrown from within the try block using the throw statement, and caught outside the try block with a catch statement. To correct this error Enclose code that can throw an exception in a try block, and ensure there is a corresponding catch block. Make sure your catch statement expects the correct form of exception. If the exception is rethrown, make sure there is another corresponding catch statement.
5023 | Function does not have a valid prototype object You attempted to use instanceof to determine if an object was derived from a particular function class, but you redefined the object's prototype property as either null, or an external object type (both not valid JScript objects). An external object can be an object from the host object model (for example, Internet Explorer's document or window object), or an external COM object. To correct this error Ensure the function's prototype property refers to a valid JScript object.
5024 | The URI to be encoded contains an invalid character You attempted to encode a string as a URI (Uniform Resource Identifier), but it contained invalid characters. Although most characters are valid inside strings to be converted to URIs, some Unicode character sequences are illegal. To correct this error Ensure the string to be encoded contains only valid Unicode sequences. A complete URI is composed of a sequence of components and separators. The general form is:
    <Scheme>:<first>/<second>;<third>?<fourth>
The names in angle brackets represent components, and the ":", "/", ";" and "?" are reserved characters used as separators.
5025 | The URI to be decoded is not a valid encoding You attempted to decode an improperly formed URI (Uniform Resource Identifier). URIs have a special syntax; most non-alphanumeric characters must be encoded before they can be used in a URI. You can use the encodeURI and encodeURIComponent methods to create a URI from a normal JScript string. A complete URI is composed of a sequence of components and separators. The general form is:
    <Scheme>:<first>/<second>;<third>?<fourth>
The names in angle brackets represent components, and the ":", "/", ";" and "?" are reserved characters used as separators. To correct this error Ensure you are trying to decode valid URIs only. You cannot decode normal JScript strings, as they may contain invalid characters.
5026 | The number of fractional digits is out of range You attempted to pass an invalid argument to the function Number.prototype.toExponential. The argument to the function toExponential() must be between 0 and 20 (inclusive). To correct this error Ensure the argument to toExponential() is not too large or too small.
5027 | The precision is out of range You attempted to pass an invalid argument to the function Number.prototype.toPrecision. The argument to toPrecision must between 1 and 21 (inclusive). To correct this error Ensure the argument to toPrecision is not too large or too small.
5028 | Array or arguments object expected You did not supply an array as an argument. This error applies to the Function.prototype.apply method only. If specified, the second argument to this function must be either an Array object or an Arguments object. To correct this error Specify either an Array or an Arguments object as the second argument.
- 5029 | Array length must be a finite positive integer You are calling the Array constructor with an argument that is not a whole number (whole numbers consist of zero plus the set of positive integers). To correct this error Use positive integers only when creating a new Array object. If you want to create an array with a single element that is not an integer, do it in a two-step process. First create an array with one element, then place the value in the first element (array[0]). The following is an example that generates this error.
      var piArray = new Array(3.14159);
  The following example demonstrates the correct way to specify an array with a single numeric element.
      var piArray = new Array(1);
      piArray [0] = 3.14159;
There is no upper limit for the size of an array, other than the maximum integer value (approximately 4 billion).
- 5030 | Array length must be assigned a finite positive number When setting the length property of an existing Array object, you specified an array length that was not a positive number or zero. This error occurs when you assign a value to the length property of an Array object that is negative or not a number (NaN). Note that JScript automatically converts fractional numbers to whole integers. To correct this error Assign a positive whole number to the length property. There is no upper limit for the size of an array, other than the maximum integer value (approximately 4 billion). The following example demonstrates the correct way to set the length property of an Array object.
      var my_array = new Array();
      my_array.length = 99;