Skip to content
ChartDeck ChartScript docs Account Open the terminal

CS5001

error message

#What it means

The script was stopped with a message, shown as it is. Usually the script itself called runtime.error(...); a few built-ins also stop with their own message, such as a str.match pattern that is not supported.

#Typical cause

  • A runtime.error call in your code was reached, often to refuse settings that cannot work.
  • A built-in that refused its arguments, with the reason in the message.

#How to fix it

Read the message: it says what to change. If it comes from your own runtime.error, change the settings or the condition that leads to it. See Debugging.

#Example

ChartScriptOpen in editor
//@chartscript 1
indicator("Guarded length")
const len = input.int(0, "Length")
if (len < 1) {
    runtime.error("Length must be at least 1")
}
plot(ta.sma(close, math.max(len, 1)))

Fixed

ChartScriptOpen in editor
//@chartscript 1
indicator("Guarded length")
const len = input.int(14, "Length", { minval: 1 })
plot(ta.sma(close, len))
  • CS5501 — Internal runtime error: detail

The ChartScript documentation is in English for now; translations will follow.