Diagnostics
Diagnostics
Stable Scripting v3 compiler diagnostic codes with failing and corrected examples.
These diagnostics explain script errors and how to correct them.
C001— mutation of a frozen valueC002— read-only collection passed to a function that changes itC003— collection cannot contain another collectionC004— key is missing from a frozen mapC005— empty array needs an explicit capacityC006— mutation of a read-only subscription seriesC007— series cannot be saved or passed hereI000— something went wrong while checking this scriptL001— too many separate stateful calculationsL002— struct field limit exceededL003— user type limit exceededL004— struct nesting limit exceededL005— map key is too longL006— subscription declaration limit exceededL007— collection or series capacity exceeds the supported limitL008— negative collection/series capacityL009— source exceeds the maximum sizeL010— input declaration limit exceededL011— plot declaration limit exceededL012— fill declaration limit exceededL013— alert declaration limit exceededL014— alert payload field limit exceededN001— value may be null hereN002— null check on a field or index does not carry overN003— null needs an explicit typeP001— unrecognized tokenP002— unterminated string literalP003— semicolon is not supportedP004— legacy logical operator spellingP005—??mixed with&&or\|\|needs parenthesesP006—whileis not supportedP007— template strings are not supportedP008—?.is not supportedP009— postfix!is not supportedP011— top-level statement is not a declarationP014—breakandcontinueare not statementsP016— expected tokenP017— script options block is removedP018— bracket destructuring is not supportedP019— loop variables cannot be wrapped in parenthesesP021— invalid color literalP022— unknown string escapeP023— match arm body statement requires a blockP024— match expression arm takes an expression, not a blockP025— keyword used as a declaration nameP026— ternary broken before?or:P027— second statement on the same lineS001— live value used in setupS002— built-in function cannot run in setupS003— resource must be declared during setupS004— collection with a capacity cannot be a plain setup valueS005— collection capacity must be known before the script runsS006— duplicate panel nameS007— incorrect declarationS008— user function called in a setup expressionS009— state initializer calls a function that needs live dataS010— setup value uses a built-in that cannot run in setupS011— setup declaration reads a later-declared bindingS012— empty exchange list in subscriptionS013— color scale needs matching lists with at least two entriesS014— color scale positions must be finite and in ascending orderS015— minimum trade size must be positive and finiteS016— series must be created in a state initializerS017— series history depth must be known before the script runsS018— lambda or collection transform in setup or state initializerS019— alert constructor outside an alert declarationS020— invalid alert payload typeS021— trigger must be called on a declared alertS022— trigger argument count does not match the alert's payloadS023— trigger result used as a valueS024— alert handle re-bound in setupS025— input group cannot be assigned to a variableS026— subscription history cannot be negativeS027— the chart subscription cannot be live onlyT001— unknown identifierT002— duplicate top-level nameT003— removed builtinT004— renamed builtinT005— unknown type nameT006— local shadows builtin namespaceT007— rebinding a visible local or parameterT008— binding a declared type nameT009— user type shadows a builtin type nameT010— script declaration missing or misplacedT011— duplicate display titleT012— diagnostic output truncatedT013— unused bindingT014— unused subscriptionT015— script title contains NULT016— duplicate input keyT101— type mismatchT102— operator not defined for operand typesT103— float needs an explicit conversion to intT104— nullable collection typeT105—array<T>annotation spellingT106— invalid map key typeT107— invalid series element typeT109— type is not indexableT110—array<T>(n)constructor spelling is removedT111— invalid timeframe literalT112— zero-valued timeframe literalT113— integer literal out ofintrangeT114— invalid session time literalT115— nullable array element typeT201— unknown named argumentT202— positional argument after namedT203— argument is supplied more than onceT204— missing argumentT205— too many positional valuesT206— parameter default is not a literal constantT207— required parameter follows an optional parameterT208— null default for non-nullable parameterT209— unsupported number of return typesT210— calendar unit literal needs a timeframe or duration contextT211— wrong number of return valuesT212— not all code paths return a valueT213— multi-return call outside destructure or tail returnT214— destructure target list errorT215— no overload matches these argumentsT216— value cannot be reassignedT217— invalid assignment targetT301— struct field is missing a type annotationT302— struct contains itselfT303— type name is not UpperCamelT304— match does not cover every caseT305— null case used for a value that cannot be nullT306— struct literal field errorT307— duplicate field in type declarationT401— function calls itself directly or indirectlyT402— stateful calculation inside a loopT403— indicator input mixes timeframesT405— invalid handler for this subscriptionT406— duplicate handlerT407— handler on snapshot sourceT408— TA source uses a calendar timeframeT409— changing history index needs an explicit series depthT410— indicator over a book or volume viewT411— source has no forming viewT412— parameter list on a handler for one subscriptionT413— indicator length must be known before the script runsT414— TA window length out of rangeT415— plot method does not match the panelT416— invalid str.format templateT417— invalid time.format templateT418— subscription must refer to one known data sourceT419— alias must refer directly to one declared scale, window, pane, or alertT420— trade fields are read-onlyT421— fill boundaries belong to different panesT422— book and profile views only live for the current updateT423— profile length must be known before the script runsT424— profile must be read through its own methodsT425— solid and gradient colors given to one fill callT426— invalid lambda position or bodyT427— invalid lambda parameter listT428— stateful calculation, randomness, or drawing inside a lambdaT429— lambda changes the collection it is readingT430— collection transform must be a separate statementT431— collection transform on a seriesT432— save the value in a variable before changing itT433— invalid use ofselfT434— duplicate method or method/field name collision in a typeT435— lambda cannot change its element copyT436— loop or handler variable cannot be reassignedT437— table row cell count differs from the declared column countT438— unsupported table cell value typeT439— time coordinate on a pixel-positioned axisT440— fill lines use different kinds of coordinatesT441— extension direction does not work with this anchorT442— struct literal does not start with a type nameT443— title literal exceeds 256 bytesT444— plot anchor is not a top or bottom edgeT445— arrow has a vertical extend modeT446— window field value is not a panelT447— horizontal histogram targets a non-category panelT448— panel is shared between window fieldsT449— isLast read inside a close handler