slint-ui/slint · error

can't load palette

Error message

can't load palette

What it means

Error "can't load palette" thrown in slint-ui/slint.

Source

Thrown at internal/compiler/passes.rs:106

        // Ignore import errors
        let mut build_diags_to_ignore = crate::diagnostics::BuildDiagnostics::default();
        // Import from style-base.slint instead of std-widgets.slint to avoid loading
        // the entire widget library just to get StyleMetrics.
        type_loader
            .import_component("style-base.slint", "StyleMetrics", &mut build_diags_to_ignore)
            .await
            .unwrap_or_else(|| panic!("can't load style metrics"))
    };

    let palette = {
        // Ignore import errors
        let mut build_diags_to_ignore = crate::diagnostics::BuildDiagnostics::default();
        // Import from style-base.slint instead of std-widgets.slint to avoid loading
        // the entire widget library just to get Palette.
        type_loader
            .import_component("style-base.slint", "Palette", &mut build_diags_to_ignore)
            .await
            .unwrap_or_else(|| panic!("can't load palette"))
    };

    let global_type_registry = type_loader.global_type_registry.clone();
    // The shared symbol-name counters, handed to the passes that generate names.
    let symbol_counters = type_loader.symbol_counters.clone();

    run_import_passes(doc, type_loader, diag);
    check_public_api::check_public_api(doc, &type_loader.compiler_config, diag);

    let raw_type_loader =
        keep_raw.then(|| crate::typeloader::snapshot_with_extra_doc(type_loader, doc).unwrap());

    // Inject debug hooks early — before any lowering or inlining — so source element identity
    // is preserved and hooks can be attributed to the correct source location.
    if let Some(random_state) = &type_loader.compiler_config.debug_hooks {
        for root_component in doc.exported_roots() {
            inject_debug_hooks::inject_debug_hooks(&root_component, random_state);
        }

View on GitHub (pinned to 3fd8f2ec03)

Solutions

  1. Ensure the selected style's palette definition is present in the compiler resources.
  2. Pick a supported style via the style option.

When it happens

Trigger: Thrown at internal/compiler/passes.rs:106 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of slint-ui/slint@3fd8f2ec03 (2026-08-19). Data as JSON: /api/errors/60f95702f8323c89. Report an issue: GitHub.