{"record":{"id":"7c770f4603b813b0","repo":"usebruno/bruno","slug":"unsupported-export-format-exportformat","errorCode":null,"errorMessage":"Unsupported export format: ${exportFormat}","messagePattern":"Unsupported export format: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/bruno-electron/src/ipc/collection.js","lineNumber":1037,"sourceCode":"          environments\n        };\n\n        const jsonContent = JSON.stringify(exportData, null, 2);\n        await fs.promises.writeFile(fullPath, jsonContent, 'utf8');\n      } else if (exportFormat === 'single-object') {\n        // single environment json file\n        if (environments.length !== 1) {\n          throw new Error('Single object export requires exactly one environment');\n        }\n\n        const environment = environments[0];\n        const baseFileName = environment.name ? `${environment.name.replace(/[^a-zA-Z0-9-_]/g, '_')}` : 'environment';\n        const uniqueFileName = generateUniqueName(baseFileName, (name) => fs.existsSync(path.join(filePath, `${name}.json`)));\n        const fullPath = path.join(filePath, `${uniqueFileName}.json`);\n        const jsonContent = JSON.stringify(environmentWithInfo(environment), null, 2);\n        await fs.promises.writeFile(fullPath, jsonContent, 'utf8');\n      } else {\n        throw new Error(`Unsupported export format: ${exportFormat}`);\n      }\n    } catch (error) {\n      return Promise.reject(error);\n    }\n  });\n\n  // rename item\n  ipcMain.handle('renderer:rename-item-name', async (event, { itemPath, newName, collectionPathname }) => {\n    try {\n      validatePathIsInsideCollection(itemPath);\n\n      if (!fs.existsSync(itemPath)) {\n        throw new Error(`path: ${itemPath} does not exist`);\n      }\n\n      if (isDirectory(itemPath)) {\n        const format = getCollectionFormat(collectionPathname);\n        const folderFilePath = path.join(itemPath, `folder.${format}`);","sourceCodeStart":1019,"sourceCodeEnd":1055,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/ipc/collection.js#L1019-L1055","documentation":"Thrown by 'renderer:export-environment' when exportFormat is not one of the handled branches ('folder', 'single-object', and any earlier combined branch). The handler's final else clause catches any unrecognized format string.","triggerScenarios":"Passing exportFormat values like 'json', 'combined' (if not an implemented branch), 'single', undefined (when no default applies), or a typo'd literal.","commonSituations":"Caller refactored format names out of sync with the handler, used a value from an older/newer Bruno version, or sent undefined expecting the documented default 'folder'.","solutions":["Use only the format literals the handler recognizes ('folder', 'single-object'); default to 'folder' when unsure.","Share a constant for exportFormat across renderer and main to avoid drift.","Check the Bruno version's handler source for the accepted branches before adding a new option."],"exampleFix":"// before\nawait window.Ipc.invoke('renderer:export-environment', { environments, environmentType, filePath, exportFormat: 'json' });\n\n// after\nawait window.Ipc.invoke('renderer:export-environment', { environments, environmentType, filePath, exportFormat: 'folder' });","handlingStrategy":"type-guard","validationCode":"const EXPORT_FORMATS = new Set(['folder', 'single-object']);\nconst fmt = EXPORT_FORMATS.has(exportFormat) ? exportFormat : 'folder';\nawait window.Ipc.invoke('renderer:export-environment', { environments, environmentType, filePath, exportFormat: fmt });","typeGuard":"function isExportFormat(v: unknown): v is 'folder' | 'single-object' {\n  return v === 'folder' || v === 'single-object';\n}","tryCatchPattern":null,"preventionTips":["Share the exportFormat literal set between renderer and main.","Default to 'folder' when the value is uncertain.","Re-check accepted formats after upgrading Bruno."],"tags":["ipc","export","enum","validation"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}