linebender/druid · error

More than one path received for save action

Error message

More than one path received for save action

What it means

Validation error returned by get_file_dialog_path on GTK: the file chooser dialog was closed with ResponseType::Accept but returned more than one filename while the request was for a single-selection (or non-save) operation, so the result cannot be represented as one path. It fires when the dialog's multi_selection option mismatches how the user selected files or when options.multi_selection is false but multiple files were chosen.

Solutions

  1. Set multi_selection: true in FileDialogOptions when the user should be able to pick multiple files
  2. Use the open/multi-open dialog API variant when multiple paths are expected
  3. Take only the first filename if a single path is acceptable, instead of erroring
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at druid-shell/src/backend/gtk/dialog.rs:97 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/0a0ad05938bc3f10. Report an issue: GitHub.

Appendix: source

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

        }
    }

    if let Some(default_name) = &options.default_name {
        dialog.set_current_name(default_name);
    }

    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)