Skip to content

Warnings & Limits

The compiler returns diagnostic information that does not stop compilation through the warnings array. Each warning object has these fields:

type LuisCompileWarning = {
code: string
line: number
message: string
}

There are two policies: fail-closed and fail-soft.

PolicyBehavior on limit exceeded
fail-closedProduces a compile error and stops compilation
fail-softProduces a resource-limit warning and compilation continues

The default policy is fail-closed. When debug: true is provided, the default policy switches to fail-soft.


CodeTrigger Scenario
missing-semicolonA ; is missing after a declaration or composition line
invalid-syntaxInvalid .luis syntax — present in the type definition; these scenarios are generally error-path behavior and are not emitted as warnings
CodeTrigger Scenario
invalid-directive-orderDirectives like @charset, @layer are written in the wrong order
invalid-directive-positionA directive is used in a disallowed position
CodeTrigger Scenario
unsupported-importImport format not supported by the compiler, or a .luis import exists when importResolver is not defined
import-not-foundimportResolver returned null — import could not be resolved
import-cycleTwo or more .luis files import each other
invalid-import-urlUnsafe or unsupported URL used (javascript:, etc.)
duplicate-import-variableThe same variable was defined more than once from different imports
CodeTrigger Scenario
invalid-array-range-unitStart and end units differ in an array range ([1px-3rem] etc.)
invalid-object-loop-accessObject key access was attempted on a non-object value in a @for loop
CodeTrigger Scenario
invalid-function-syntaxFunction definition syntax is invalid
invalid-function-nameFunction name contains invalid characters
duplicate-functionTwo functions with the same name were defined
unknown-function-callAn undefined function was called
invalid-function-callA function call was made in an invalid form
function-argument-mismatchThe argument count in the call does not match the definition
function-recursionA function calls itself
CodeTrigger Scenario
resource-limitfail-soft mode only: a resource limit was exceeded

LimitDefaultDescription
maxForIterationsPerLoop2,000Maximum iteration count in a single @for loop
maxNestedLoopProduct100,000Iteration product limit in nested loops (i × j × k…)
maxExpandedRules50,000Maximum number of rules that can be produced in compilation
maxOutputCssChars3,000,000Maximum character count of the final CSS output
maxImportDepth64Maximum depth allowed in an import chain
maxImportCount2,000Total number of imports that can be resolved during compilation
maxImportedBytes4,000,000Total imported source character/byte budget
LimitDefaultDescription
maxObservedRules5,000Total observed rule count that can be accepted during compilation
maxObservedActiveRules1,000Number of observed rules that can be active at the same time at runtime
maxObservedRuleKeysPerToken300Maximum rule key count that can be held for a single token in the runtime index
maxMutationBatchTokens1,500Number of tokens that can be processed in a single mutation batch at runtime
maxObservedReevalPerTick500Number of observed rules that can be re-evaluated in a single tick at runtime

When resourcePolicy: 'fail-soft' is active, the compilation state and generated output for each error type:

Error TypeOutputWarning Code
Missing ;Rule is generated as-ismissing-semicolon
Invalid selectorNo general warning is produced; selector text is generally emitted as-is. Some observed suffix errors fall back to static selector. Structural syntax errors stop compilation with an error.
Invalid ${...} expressionNot converted to a warning; throws Invalid .luis syntax ... error and stops compilation. Not converted to an empty string.
Unknown @fun callCall is skippedunknown-function-call
Argument count mismatchCall is not expandedfunction-argument-mismatch
Unsafe or unsupported @import URLImport is skippedinvalid-import-url
Import depth / count / imported-bytes limit exceededresource-limit warning is produced; the branch that exceeds the limit is cutresource-limit
Loop / nested loop limit exceededresource-limit warning is produced; the loop block that exceeds the limit is skippedresource-limit
Expanded rule limit exceededresource-limit warning is produced; extra rules are cut to the limitresource-limit
Observed rule limit exceededresource-limit warning is produced; non-observed rules are preserved, observed rules are filtered to the limitresource-limit
Final CSS size limit exceededresource-limit warning is produced; CSS output is returned as-is, not truncatedresource-limit

In fail-soft mode, the behavior on exceeding each limit differs:

Limit ExceededBehavior
Import depth / count / imported-bytes limitresource-limit warning is produced; the branch that exceeds the limit is cut at resolution
Loop iteration / nested loop product limitresource-limit warning is produced; the loop block that exceeds the limit is skipped
Expanded rule limitresource-limit warning is produced; extra rules are cut to the limit
Observed rule limit (maxObservedRules)resource-limit warning is produced; non-observed rules are preserved, observed rules are filtered to the limit
Final CSS size limitresource-limit warning is produced; CSS output is returned as-is, not truncated
Mutation batch limit (maxMutationBatchTokens)resource-limit warning is produced; the token set to be processed is cut to the limit
Observed reevaluation limit (maxObservedReevalPerTick)resource-limit warning is produced; the rule key set to be re-evaluated is cut to the limit
Active observed rule limit (maxObservedActiveRules)resource-limit warning is produced; the active rule key set is cut to the limit