wailsapp/wails · error
use ShowAndGetResult for open single file dialog
Error message
use ShowAndGetResult for open single file dialog
What it means
The v3 copy of go-common-file-dialog: ShowAndGetResults() panics when the open dialog is single-select, since the multi-results COM path is only valid for dialogs created with the multiselect flag. The library treats the mismatch as a programming error rather than returning an error.
Source
Thrown at v3/internal/go-common-file-dialog/cfd/iFileOpenDialog.go:68
}
if isMultiselect {
// We should panic as this error is caused by the developer using the library
panic("use ShowAndGetResults for open multiple files dialog")
}
if err := fileOpenDialog.Show(); err != nil {
return "", err
}
return fileOpenDialog.GetResult()
}
func (fileOpenDialog *iFileOpenDialog) ShowAndGetResults() ([]string, error) {
isMultiselect, err := fileOpenDialog.isMultiselect()
if err != nil {
return nil, err
}
if !isMultiselect {
// We should panic as this error is caused by the developer using the library
panic("use ShowAndGetResult for open single file dialog")
}
if err := fileOpenDialog.Show(); err != nil {
return nil, err
}
return fileOpenDialog.GetResults()
}
func (fileOpenDialog *iFileOpenDialog) SetTitle(title string) error {
return fileOpenDialog.vtbl.setTitle(unsafe.Pointer(fileOpenDialog), title)
}
func (fileOpenDialog *iFileOpenDialog) GetResult() (string, error) {
isMultiselect, err := fileOpenDialog.isMultiselect()
if err != nil {
return "", err
}
if isMultiselect {
// We should panic as this error is caused by the developer using the libraryView on GitHub (pinned to 0e754b1b40)
Solutions
- Use ShowAndGetResult() (singular) for single-select dialogs
- Enable the multiselect option at dialog creation if multiple files are expected
Example fix
// before paths, err := dialog.ShowAndGetResults() // single dialog: panics // after path, err := dialog.ShowAndGetResult()
Defensive patterns
Strategy: type-guard
Validate before calling
// single-select: singular helper path, err := dialog.ShowAndGetResult()
Type guard
func openOneV3(d cfd.Dialog) (string, error) {
return d.ShowAndGetResult()
} Prevention
- Use the paired ShowAndGet* helpers instead of manual sequences
- Update call sites whenever you flip the multiselect flag
When it happens
Trigger: Calling ShowAndGetResults() on a default single-select open dialog in a v3 app.
Common situations: Reusing multi-select sample code for a plain open dialog; refactoring a dialog between single and multi modes without updating call sites.
Related errors
- use ShowAndGetResults for open multiple files dialog
- use GetResults for open multiple files dialog
- use GetResult for open single file dialog
- use ShowAndGetResults for open multiple files dialog
- use ShowAndGetResult for open single file dialog
AI-assisted analysis of wailsapp/wails@0e754b1b40 (2026-08-15).
Data as JSON: /api/errors/a4c3e4459ca3c2d6.
Report an issue: GitHub.