slint-ui/slint · error

SLINT_INLINING has incorrect value. Must be either unset…

Error message

SLINT_INLINING has incorrect value. Must be either unset, 'true' or 'false'

What it means

CompilerConfiguration::new parses the SLINT_INLINING environment variable as a boolean; any value other than 'true' or 'false' causes parse::<bool>() to fail and panic. The variable forces element inlining on/off during compilation; when unset, inlining defaults to on for the Interpreter output format.

Solutions

  1. Set SLINT_INLINING to exactly `true` or `false` (lowercase)
  2. Unset SLINT_INLINING to use the default (enabled for Interpreter output format, disabled otherwise)
  3. Check build scripts/CI env exports for stray boolean formatting

Example fix

// before
export SLINT_INLINING=yes
// after
export SLINT_INLINING=false
Defensive patterns

Strategy: validation

Validate before calling

if let Some(v) = std::env::var("SLINT_INLINING").ok() {
    assert!(matches!(v.as_str(), "true" | "false"), "SLINT_INLINING must be 'true' or 'false', got {v:?}");
}

Prevention

When it happens

Trigger: Setting SLINT_INLINING to a non-boolean value (e.g. '1', 'yes', 'True') in the environment before constructing a CompilerConfiguration.

Common situations: Shell scripts exporting SLINT_INLINING=1 assuming numeric booleans; misconfigured CI environments shared with SLINT_EMBED_RESOURCES.

Understand the failure class

Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.

Related errors


AI-assisted analysis of slint-ui/slint@3a7e700487 (2026-09-16). Data as JSON: /api/errors/d2e6ebc9e5d1833d. Report an issue: GitHub.

Appendix: source

Thrown at internal/compiler/lib.rs:265

            let var = var.parse::<bool>().unwrap_or_else(|_|{
                panic!("SLINT_EMBED_RESOURCES has incorrect value. Must be either unset, 'true' or 'false'")
            });
            match var {
                true => EmbedResourcesKind::EmbedAllResources,
                false => EmbedResourcesKind::OnlyBuiltinResources,
            }
        } else {
            match output_format {
                #[cfg(feature = "rust")]
                OutputFormat::Rust => EmbedResourcesKind::EmbedAllResources,
                OutputFormat::Interpreter => EmbedResourcesKind::Nothing,
                _ => EmbedResourcesKind::OnlyBuiltinResources,
            }
        };

        let inline_all_elements = match std::env::var("SLINT_INLINING") {
            Ok(var) => var.parse::<bool>().unwrap_or_else(|_| {
                panic!(
                    "SLINT_INLINING has incorrect value. Must be either unset, 'true' or 'false'"
                )
            }),
            // Currently, the interpreter needs the inlining to be on.
            Err(_) => output_format == OutputFormat::Interpreter,
        };

        // The Slint SC generator flattens the exported component's element
        // tree, so user-defined components must be inlined away. This
        // overrides a SLINT_INLINING=false env override.
        #[cfg(feature = "slint-sc")]
        let inline_all_elements =
            inline_all_elements || matches!(output_format, OutputFormat::SlintSc);

        let const_scale_factor = std::env::var("SLINT_SCALE_FACTOR")
            .ok()
            .and_then(|x| x.parse::<f32>().ok())
            .filter(|f| *f > 0.);

View on GitHub (pinned to 3a7e700487)