FlowscopeDocs

C003

collection cannot contain another collection

Severity Error

A collection created at run time (in state or a handler) has another collection as its element or value type, such as map<string, float[]>. Run-time collections have a fixed capacity per element type, and nesting them would make their memory unbounded.

Flatten the data: use composite keys ("binance:longs"), a record type with plain fields, or one collection per inner list.

Failing example

Flowscope Script
script "Per-venue history"
data chart = subscribe(data.ohlcv)
state history = map<string, float[]>(8)
on chart.close {
  log.debug(str.format("{0} venues", history.len))
}

Fixed example

Flowscope Script
script "Per-venue history"
data chart = subscribe(data.ohlcv)
state history = map<string, float>(64)
on chart.close {
  history[str.format("{0}:{1}", context.exchange, chart.index)] = chart.close ?? 0.0
  log.debug(str.format("{0} entries", history.len))
}