linebender/druid · error

Unhandled dialog result

Error message

Unhandled dialog result

What it means

Catch-all error arm in get_file_dialog_path: the GTK dialog returned a ResponseType other than Accept (and other than the handled cancel/delete cases), so the result cannot be interpreted as a file selection. It fires when the chooser emits an unexpected response — a delete-event, an unhandled response id, or a GTK-internal response.

Solutions

  1. Map ResponseType::Cancel/DeleteEvent explicitly to Ok(None) so only truly unknown responses hit this arm
  2. Log the raw response value to diagnose which GTK response id arrived
  3. Treat unknown responses as user cancellation and return None instead of a hard error
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at druid-shell/src/backend/gtk/dialog.rs:104 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of linebender/druid@0f8b1195e4 (2026-09-10). Data as JSON: /api/errors/f667987eb5c2d0b1. Report an issue: GitHub.

Appendix: source

Thrown at druid-shell/src/backend/gtk/dialog.rs:104

    let result = dialog.run();

    let result = match result {
        ResponseType::Accept => match dialog.filenames() {
            filenames if filenames.is_empty() => Err(anyhow!("No path received for filename")),
            // If we receive more than one file, but `multi_selection` is false, return an error.
            filenames if filenames.len() > 1 && !options.multi_selection => {
                Err(anyhow!("More than one path received for single selection"))
            }
            // If we receive more than one file with a save action, return an error.
            filenames if filenames.len() > 1 && action == FileChooserAction::Save => {
                Err(anyhow!("More than one path received for save action"))
            }
            filenames => Ok(filenames.into_iter().map(|p| p.into_os_string()).collect()),
        },
        ResponseType::Cancel => Err(anyhow!("Dialog was deleted")),
        _ => {
            tracing::warn!("Unhandled dialog result: {:?}", result);
            Err(anyhow!("Unhandled dialog result"))
        }
    };

    // TODO properly handle errors into the Error type

    dialog.destroy();

    Ok(result?)
}

View on GitHub (pinned to 0f8b1195e4)