{"record":{"id":"8c9b05eca606bf0a","repo":"wailsapp/wails","slug":"use-getresults-for-open-multiple-files-dialog-8c9b05","errorCode":null,"errorMessage":"use GetResults for open multiple files dialog","messagePattern":"use GetResults for open multiple files dialog","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/internal/go-common-file-dialog/cfd/iFileOpenDialog.go","lineNumber":87,"sourceCode":"\t}\n\tif err := fileOpenDialog.Show(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn fileOpenDialog.GetResults()\n}\n\nfunc (fileOpenDialog *iFileOpenDialog) SetTitle(title string) error {\n\treturn fileOpenDialog.vtbl.setTitle(unsafe.Pointer(fileOpenDialog), title)\n}\n\nfunc (fileOpenDialog *iFileOpenDialog) GetResult() (string, error) {\n\tisMultiselect, err := fileOpenDialog.isMultiselect()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif isMultiselect {\n\t\t// We should panic as this error is caused by the developer using the library\n\t\tpanic(\"use GetResults for open multiple files dialog\")\n\t}\n\treturn fileOpenDialog.vtbl.getResultString(unsafe.Pointer(fileOpenDialog))\n}\n\nfunc (fileOpenDialog *iFileOpenDialog) Release() error {\n\treturn fileOpenDialog.vtbl.release(unsafe.Pointer(fileOpenDialog))\n}\n\nfunc (fileOpenDialog *iFileOpenDialog) SetDefaultFolder(defaultFolderPath string) error {\n\treturn fileOpenDialog.vtbl.setDefaultFolder(unsafe.Pointer(fileOpenDialog), defaultFolderPath)\n}\n\nfunc (fileOpenDialog *iFileOpenDialog) SetFolder(defaultFolderPath string) error {\n\treturn fileOpenDialog.vtbl.setFolder(unsafe.Pointer(fileOpenDialog), defaultFolderPath)\n}\n\nfunc (fileOpenDialog *iFileOpenDialog) SetFileFilters(filter []FileFilter) error {\n\treturn fileOpenDialog.vtbl.setFileTypes(unsafe.Pointer(fileOpenDialog), filter)","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/wailsapp/wails/blob/0e754b1b40ba9044c2a1460e23b7c3de20fc5cf3/v3/internal/go-common-file-dialog/cfd/iFileOpenDialog.go#L69-L105","documentation":"The v3 copy of go-common-file-dialog: GetResult() (singular) panics on multi-select dialogs because the underlying single-result COM call cannot return the user's multiple picks. Callers who split Show() and result retrieval must pick the accessor matching the dialog mode.","triggerScenarios":"Calling dialog.Show() manually and then GetResult() on a multiselect-enabled dialog.","commonSituations":"Custom dialog lifecycles (show, poll, then fetch results) that were first written for single-select and reused for multi-select.","solutions":["Call GetResults() (plural) after Show() on multi-select dialogs","Or simply use ShowAndGetResults() which pairs correctly by construction"],"exampleFix":"// before\n_ = dialog.Show()\npath, err := dialog.GetResult() // multiselect: panics\n\n// after\n_ = dialog.Show()\npaths, err := dialog.GetResults()","handlingStrategy":"type-guard","validationCode":"// after manual Show(), match accessor to mode\nif multi {\n    paths, err := dialog.GetResults()\n} else {\n    path, err := dialog.GetResult()\n}","typeGuard":"var _ cfd.MultiFileDialog = dialog\npaths, err := dialog.GetResults()","tryCatchPattern":null,"preventionTips":["Prefer ShowAndGetResults() for the whole show-and-fetch sequence","Keep mode flag and accessor choice in the same function"],"tags":["file-dialog","windows","api-misuse","panic","v3"],"backgroundTag":null,"analyzedSha":"0e754b1b40ba9044c2a1460e23b7c3de20fc5cf3","analyzedAt":"2026-08-15T14:17:36.034Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}