Budibase/budibase · error · BadRequestError
No file provided
Error message
No file provided
What it means
Thrown by uploadFile when ctx.request.files.file is missing from a multipart upload request. The endpoint expects a multipart/form-data body with a file field; without it there is nothing to process.
Source
Thrown at packages/server/src/api/controllers/static/index.ts:253
return upload.filepath
}
const getUploadMimeType = (file: unknown) => {
if (!file || typeof file !== "object") {
return undefined
}
const upload = file as {
mimetype?: string | null
}
return upload.mimetype || undefined
}
export const uploadFile = async function (
ctx: Ctx<void, ProcessAttachmentResponse>
) {
const file = ctx.request?.files?.file
if (!file) {
throw new BadRequestError("No file provided")
}
let files = file && Array.isArray(file) ? Array.from(file) : [file]
ctx.body = await Promise.all(
files.map(async file => {
const fileName = getUploadFilename(file)
const filePath = getUploadPath(file)
const rawMimeType = getUploadMimeType(file)
if (!fileName) {
throw new BadRequestError(
"Attempted to upload a file without a filename"
)
}
if (!filePath) {
throw new BadRequestError("Attempted to upload a file without a path")
}
View on GitHub (pinned to a81a902e9a)
Solutions
- Send multipart/form-data with the file under the field name 'file'
- Check the HTTP client attaches the file part correctly (e.g. FormData.append('file', blob))
- Verify no proxy/middleware is dropping the request body
Example fix
// before
const fd = new FormData(); fd.append('attachment', file)
// after
const fd = new FormData(); fd.append('file', file) Defensive patterns
Strategy: validation
Validate before calling
function hasFilePart(form: FormData) {
const f = form.get('file')
return f instanceof File || f instanceof Blob
} Type guard
const isUploadedFile = (f: unknown): f is { filename?: string; path?: string; size: number } =>
typeof f === 'object' && f !== null && 'size' in f Try / catch
try {
await api.uploadFile(formData)
} catch (err) {
if (err instanceof BadRequestError && err.message === 'No file provided') {
// fix the form field name to 'file' and resend
} else throw err
} Prevention
- Always send multipart/form-data with the part named exactly 'file'
- Verify with devtools that the request contains a file part
- Ensure the form enctype is multipart/form-data
When it happens
Trigger: POSTing to the file upload endpoint without a 'file' part, sending JSON instead of multipart/form-data, or using a different field name (e.g. 'attachment').
Common situations: Client forgetting to set enctype='multipart/form-data', SDK clients sending the file under the wrong form key, or proxies stripping the body.
Related errors
- File is not valid - cannot upload.
- Attempted to upload a file without a filename
- Attempted to upload a file without a path
- Stream to upload is invalid/undefined
- Plugin missing .js file.
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/2c92e9ea48bfc587.
Report an issue: GitHub.