MMTMMT Docs
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 value
  • C002 — read-only collection passed to a function that changes it
  • C003 — collection cannot contain another collection
  • C004 — key is missing from a frozen map
  • C005 — empty array needs an explicit capacity
  • C006 — mutation of a read-only subscription series
  • C007 — series cannot be saved or passed here
  • I000 — something went wrong while checking this script
  • L001 — too many separate stateful calculations
  • L002 — struct field limit exceeded
  • L003 — user type limit exceeded
  • L004 — struct nesting limit exceeded
  • L005 — map key is too long
  • L006 — subscription declaration limit exceeded
  • L007 — collection or series capacity exceeds the supported limit
  • L008 — negative collection/series capacity
  • L009 — source exceeds the maximum size
  • L010 — input declaration limit exceeded
  • L011 — plot declaration limit exceeded
  • L012 — fill declaration limit exceeded
  • L013 — alert declaration limit exceeded
  • L014 — alert payload field limit exceeded
  • N001 — value may be null here
  • N002 — null check on a field or index does not carry over
  • N003 — null needs an explicit type
  • P001 — unrecognized token
  • P002 — unterminated string literal
  • P003 — semicolon is not supported
  • P004 — legacy logical operator spelling
  • P005 — ?? mixed with && or \|\| needs parentheses
  • P006 — while is not supported
  • P007 — template strings are not supported
  • P008 — ?. is not supported
  • P009 — postfix ! is not supported
  • P011 — top-level statement is not a declaration
  • P014 — break and continue are not statements
  • P016 — expected token
  • P017 — script options block is removed
  • P018 — bracket destructuring is not supported
  • P019 — loop variables cannot be wrapped in parentheses
  • P021 — invalid color literal
  • P022 — unknown string escape
  • P023 — match arm body statement requires a block
  • P024 — match expression arm takes an expression, not a block
  • P025 — keyword used as a declaration name
  • P026 — ternary broken before ? or :
  • P027 — second statement on the same line
  • S001 — live value used in setup
  • S002 — built-in function cannot run in setup
  • S003 — resource must be declared during setup
  • S004 — collection with a capacity cannot be a plain setup value
  • S005 — collection capacity must be known before the script runs
  • S006 — duplicate panel name
  • S007 — incorrect declaration
  • S008 — user function called in a setup expression
  • S009 — state initializer calls a function that needs live data
  • S010 — setup value uses a built-in that cannot run in setup
  • S011 — setup declaration reads a later-declared binding
  • S012 — empty exchange list in subscription
  • S013 — color scale needs matching lists with at least two entries
  • S014 — color scale positions must be finite and in ascending order
  • S015 — minimum trade size must be positive and finite
  • S016 — series must be created in a state initializer
  • S017 — series history depth must be known before the script runs
  • S018 — lambda or collection transform in setup or state initializer
  • S019 — alert constructor outside an alert declaration
  • S020 — invalid alert payload type
  • S021 — trigger must be called on a declared alert
  • S022 — trigger argument count does not match the alert's payload
  • S023 — trigger result used as a value
  • S024 — alert handle re-bound in setup
  • S025 — input group cannot be assigned to a variable
  • S026 — subscription history cannot be negative
  • S027 — the chart subscription cannot be live only
  • T001 — unknown identifier
  • T002 — duplicate top-level name
  • T003 — removed builtin
  • T004 — renamed builtin
  • T005 — unknown type name
  • T006 — local shadows builtin namespace
  • T007 — rebinding a visible local or parameter
  • T008 — binding a declared type name
  • T009 — user type shadows a builtin type name
  • T010 — script declaration missing or misplaced
  • T011 — duplicate display title
  • T012 — diagnostic output truncated
  • T013 — unused binding
  • T014 — unused subscription
  • T015 — script title contains NUL
  • T016 — duplicate input key
  • T101 — type mismatch
  • T102 — operator not defined for operand types
  • T103 — float needs an explicit conversion to int
  • T104 — nullable collection type
  • T105 — array<T> annotation spelling
  • T106 — invalid map key type
  • T107 — invalid series element type
  • T109 — type is not indexable
  • T110 — array<T>(n) constructor spelling is removed
  • T111 — invalid timeframe literal
  • T112 — zero-valued timeframe literal
  • T113 — integer literal out of int range
  • T114 — invalid session time literal
  • T115 — nullable array element type
  • T201 — unknown named argument
  • T202 — positional argument after named
  • T203 — argument is supplied more than once
  • T204 — missing argument
  • T205 — too many positional values
  • T206 — parameter default is not a literal constant
  • T207 — required parameter follows an optional parameter
  • T208 — null default for non-nullable parameter
  • T209 — unsupported number of return types
  • T210 — calendar unit literal needs a timeframe or duration context
  • T211 — wrong number of return values
  • T212 — not all code paths return a value
  • T213 — multi-return call outside destructure or tail return
  • T214 — destructure target list error
  • T215 — no overload matches these arguments
  • T216 — value cannot be reassigned
  • T217 — invalid assignment target
  • T301 — struct field is missing a type annotation
  • T302 — struct contains itself
  • T303 — type name is not UpperCamel
  • T304 — match does not cover every case
  • T305 — null case used for a value that cannot be null
  • T306 — struct literal field error
  • T307 — duplicate field in type declaration
  • T401 — function calls itself directly or indirectly
  • T402 — stateful calculation inside a loop
  • T403 — indicator input mixes timeframes
  • T405 — invalid handler for this subscription
  • T406 — duplicate handler
  • T407 — handler on snapshot source
  • T408 — TA source uses a calendar timeframe
  • T409 — changing history index needs an explicit series depth
  • T410 — indicator over a book or volume view
  • T411 — source has no forming view
  • T412 — parameter list on a handler for one subscription
  • T413 — indicator length must be known before the script runs
  • T414 — TA window length out of range
  • T415 — plot method does not match the panel
  • T416 — invalid str.format template
  • T417 — invalid time.format template
  • T418 — subscription must refer to one known data source
  • T419 — alias must refer directly to one declared scale, window, pane, or alert
  • T420 — trade fields are read-only
  • T421 — fill boundaries belong to different panes
  • T422 — book and profile views only live for the current update
  • T423 — profile length must be known before the script runs
  • T424 — profile must be read through its own methods
  • T425 — solid and gradient colors given to one fill call
  • T426 — invalid lambda position or body
  • T427 — invalid lambda parameter list
  • T428 — stateful calculation, randomness, or drawing inside a lambda
  • T429 — lambda changes the collection it is reading
  • T430 — collection transform must be a separate statement
  • T431 — collection transform on a series
  • T432 — save the value in a variable before changing it
  • T433 — invalid use of self
  • T434 — duplicate method or method/field name collision in a type
  • T435 — lambda cannot change its element copy
  • T436 — loop or handler variable cannot be reassigned
  • T437 — table row cell count differs from the declared column count
  • T438 — unsupported table cell value type
  • T439 — time coordinate on a pixel-positioned axis
  • T440 — fill lines use different kinds of coordinates
  • T441 — extension direction does not work with this anchor
  • T442 — struct literal does not start with a type name
  • T443 — title literal exceeds 256 bytes
  • T444 — plot anchor is not a top or bottom edge
  • T445 — arrow has a vertical extend mode
  • T446 — window field value is not a panel
  • T447 — horizontal histogram targets a non-category panel
  • T448 — panel is shared between window fields
  • T449 — isLast read inside a close handler