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}Policy
Section titled “Policy”There are two policies: fail-closed and fail-soft.
| Policy | Behavior on limit exceeded |
|---|---|
fail-closed | Produces a compile error and stops compilation |
fail-soft | Produces 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.
Warning Codes
Section titled “Warning Codes”Syntax
Section titled “Syntax”| Code | Trigger Scenario |
|---|---|
missing-semicolon | A ; is missing after a declaration or composition line |
invalid-syntax | Invalid .luis syntax — present in the type definition; these scenarios are generally error-path behavior and are not emitted as warnings |
Directive Order and Position
Section titled “Directive Order and Position”| Code | Trigger Scenario |
|---|---|
invalid-directive-order | Directives like @charset, @layer are written in the wrong order |
invalid-directive-position | A directive is used in a disallowed position |
Import
Section titled “Import”| Code | Trigger Scenario |
|---|---|
unsupported-import | Import format not supported by the compiler, or a .luis import exists when importResolver is not defined |
import-not-found | importResolver returned null — import could not be resolved |
import-cycle | Two or more .luis files import each other |
invalid-import-url | Unsafe or unsupported URL used (javascript:, etc.) |
duplicate-import-variable | The same variable was defined more than once from different imports |
Variable and Loop
Section titled “Variable and Loop”| Code | Trigger Scenario |
|---|---|
invalid-array-range-unit | Start and end units differ in an array range ([1px-3rem] etc.) |
invalid-object-loop-access | Object key access was attempted on a non-object value in a @for loop |
Function
Section titled “Function”| Code | Trigger Scenario |
|---|---|
invalid-function-syntax | Function definition syntax is invalid |
invalid-function-name | Function name contains invalid characters |
duplicate-function | Two functions with the same name were defined |
unknown-function-call | An undefined function was called |
invalid-function-call | A function call was made in an invalid form |
function-argument-mismatch | The argument count in the call does not match the definition |
function-recursion | A function calls itself |
| Code | Trigger Scenario |
|---|---|
resource-limit | fail-soft mode only: a resource limit was exceeded |
Default Limit Values
Section titled “Default Limit Values”Compile Limits
Section titled “Compile Limits”| Limit | Default | Description |
|---|---|---|
maxForIterationsPerLoop | 2,000 | Maximum iteration count in a single @for loop |
maxNestedLoopProduct | 100,000 | Iteration product limit in nested loops (i × j × k…) |
maxExpandedRules | 50,000 | Maximum number of rules that can be produced in compilation |
maxOutputCssChars | 3,000,000 | Maximum character count of the final CSS output |
maxImportDepth | 64 | Maximum depth allowed in an import chain |
maxImportCount | 2,000 | Total number of imports that can be resolved during compilation |
maxImportedBytes | 4,000,000 | Total imported source character/byte budget |
Observed Runtime Budgets
Section titled “Observed Runtime Budgets”| Limit | Default | Description |
|---|---|---|
maxObservedRules | 5,000 | Total observed rule count that can be accepted during compilation |
maxObservedActiveRules | 1,000 | Number of observed rules that can be active at the same time at runtime |
maxObservedRuleKeysPerToken | 300 | Maximum rule key count that can be held for a single token in the runtime index |
maxMutationBatchTokens | 1,500 | Number of tokens that can be processed in a single mutation batch at runtime |
maxObservedReevalPerTick | 500 | Number of observed rules that can be re-evaluated in a single tick at runtime |
Fail-Soft Output Contract
Section titled “Fail-Soft Output Contract”When resourcePolicy: 'fail-soft' is active, the compilation state and generated output for each error type:
| Error Type | Output | Warning Code |
|---|---|---|
Missing ; | Rule is generated as-is | missing-semicolon |
| Invalid selector | No 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 ${...} expression | Not converted to a warning; throws Invalid .luis syntax ... error and stops compilation. Not converted to an empty string. | — |
Unknown @fun call | Call is skipped | unknown-function-call |
| Argument count mismatch | Call is not expanded | function-argument-mismatch |
Unsafe or unsupported @import URL | Import is skipped | invalid-import-url |
| Import depth / count / imported-bytes limit exceeded | resource-limit warning is produced; the branch that exceeds the limit is cut | resource-limit |
| Loop / nested loop limit exceeded | resource-limit warning is produced; the loop block that exceeds the limit is skipped | resource-limit |
| Expanded rule limit exceeded | resource-limit warning is produced; extra rules are cut to the limit | resource-limit |
| Observed rule limit exceeded | resource-limit warning is produced; non-observed rules are preserved, observed rules are filtered to the limit | resource-limit |
| Final CSS size limit exceeded | resource-limit warning is produced; CSS output is returned as-is, not truncated | resource-limit |
Fail-Soft Behavior on Limit Exceeded
Section titled “Fail-Soft Behavior on Limit Exceeded”In fail-soft mode, the behavior on exceeding each limit differs:
| Limit Exceeded | Behavior |
|---|---|
| Import depth / count / imported-bytes limit | resource-limit warning is produced; the branch that exceeds the limit is cut at resolution |
| Loop iteration / nested loop product limit | resource-limit warning is produced; the loop block that exceeds the limit is skipped |
| Expanded rule limit | resource-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 limit | resource-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 |