Budibase/budibase · error
Unsupported format
Error message
Unsupported format: ${format} What it means
convertDataToExportFormat in packages/shared-core/src/helpers/rowsHelper.ts only supports two export formats: "csv" (with a delimiter) and "json". Any other format string falls into the default branch and throws "Unsupported format". This is an intentional whitelist so callers cannot request an unimplemented export type.
Solutions
- Pass exactly "csv" or "json" (lowercase).
- Normalise user input with format.toLowerCase() and fall back to "csv" when unknown.
- For Excel/xlsx exports, export CSV and convert with a separate library, or use a dedicated export path.
- Restrict UI options to the two supported formats.
Example fix
// before
convertDataToExportFormat({ rows, schema, format: "xlsx" })
// after
convertDataToExportFormat({ rows, schema, format: "csv" }) Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED = new Set(["csv", "json"])
const fmt = String(requestedFormat ?? "csv").toLowerCase()
if (!SUPPORTED.has(fmt)) {
throw new Error(`Format '${requestedFormat}' unsupported; use csv or json`)
}
convertDataToExportFormat({ rows, schema, format: fmt }) Type guard
type ExportFormat = "csv" | "json"
function isExportFormat(v: unknown): v is ExportFormat {
return v === "csv" || v === "json"
} Try / catch
let output: string
try {
output = convertDataToExportFormat({ rows, schema, format })
} catch (e) {
if (e.message.startsWith("Unsupported format")) {
output = convertDataToExportFormat({ rows, schema, format: "csv" })
} else throw e
} Prevention
- Restrict export UI options to csv and json only
- Lowercase/trim user-selected format strings before passing
- Default to "csv" when the format option is absent
- Don't assume xlsx support — convert from CSV with a dedicated library
When it happens
Trigger: Calling the export helper (directly or via row export/download APIs) with format values like "xlsx", "CSV" (uppercase), "tsv", "excel", or an undefined/misspelled format variable.
Common situations: Hardcoded format strings that don't match the lowercase literals; user-configurable export format options not restricted to csv/json; passing Excel export intent to a helper that only does csv/json.
Related errors
- A column type has changed.
- A new verification key is required when changing the embed…
- actionType does not exist on DB for create
- actionType does not exist on DB for delete
- actionType does not exist on DB for update
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/6c7759f99c463048.
Report an issue: GitHub.
Appendix: source
Thrown at packages/shared-core/src/helpers/rowsHelper.ts:84
const schemaKeys = columns?.length
? columns.map(c => c.name)
: Array.from(new Set(rows.flatMap(row => Object.keys(row))))
// Normalize rows to ensure every row has all schema keys
const filteredRows = rows.map(row =>
schemaKeys.reduce((acc: Row, key) => {
acc[key] = key in row ? row[key] : ""
return acc
}, {})
)
switch (format) {
case "csv":
return convertRowsToCsv(filteredRows, schemaKeys, delimiter)
case "json":
return convertRowsToJson(filteredRows)
default:
throw new Error(`Unsupported format: ${format}`)
}
}
View on GitHub (pinned to a81a902e9a)