Budibase/budibase · error · HTTPError

Invalid format for field "${columnName}": "${columnData}". T

Error message

Invalid format for field "${columnName}": "${columnData}". Time-only fields must be in the format "HH:MM:SS".

What it means

An HTTP 400 thrown in packages/server/src/utilities/schema.ts when a value is provided for a column with timeOnly: true and it fails the TIME_REGEX validation (isValidTime in backend-core/src/sql/utils.ts). Time-only columns store just a time of day, so the value must be exactly "HH:MM:SS" (24-hour); anything else (e.g. "10:00 AM", "10:00") is rejected.

Source

Thrown at packages/server/src/utilities/schema.ts:202

                400
              )
            }
            parsedRow[columnName] = new Date(columnData.trim() + "Z")
          } else {
            if (!sql.utils.isValidISODateString(columnData)) {
              let message = `Invalid format for field "${columnName}": "${columnData}".`
              if (columnSchema.dateOnly) {
                message += ` Date-only fields must be in the format "YYYY-MM-DD".`
              } else {
                message += ` Datetime fields must be in ISO format, e.g. "YYYY-MM-DDTHH:MM:SSZ".`
              }
              throw new HTTPError(message, 400)
            }
          }
        }
        if (columnData && columnSchema.timeOnly) {
          if (!sql.utils.isValidTime(columnData)) {
            throw new HTTPError(
              `Invalid format for field "${columnName}": "${columnData}". Time-only fields must be in the format "HH:MM:SS".`,
              400
            )
          }
        }
        parsedRow[columnName] = columnData
      } else if (
        columnType === FieldType.JSON &&
        typeof columnData === "string"
      ) {
        parsedRow[columnName] = parseJsonExport(columnData)
      } else if (columnType === FieldType.BB_REFERENCE) {
        let parsedValues: { _id: string }[] = columnData || []
        if (columnData && typeof columnData === "string") {
          parsedValues = parseJsonExport<{ _id: string }[]>(columnData)
        }

        parsedRow[columnName] = parsedValues?.map(u => u._id)

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Normalise the value to 24-hour "HH:MM:SS" with seconds included before sending.
  2. Convert 12-hour formats by parsing meridiem and adding 12 to PM hours.
  3. Append ":00" when the source only supplies HH:MM.
  4. Pre-validate with a /^\d{2}:\d{2}:\d{2}$/ style check matching isValidTime before the API call.

Example fix

// before
row["startTime"] = "10:00 AM"
// after
row["startTime"] = "10:00:00"
Defensive patterns

Strategy: validation

Validate before calling

const TIME_RE = /^\d{2}:\d{2}:\d{2}$/
function normaliseTime(input: string): string {
  const m = input.trim().match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?\s*([AaPp][Mm])?$/)
  if (!m) throw new Error(`Invalid time: ${input}`)
  let h = Number(m[1])
  const meridiem = m[4]?.toUpperCase()
  if (meridiem === "PM" && h < 12) h += 12
  if (meridiem === "AM" && h === 12) h = 0
  return `${String(h).padStart(2, "0")}:${m[2]}:${m[3] ?? "00"}`
}
if (!TIME_RE.test(row.startTime)) row.startTime = normaliseTime(row.startTime)

Type guard

function isHhMmSs(v: unknown): v is string {
  return typeof v === "string" && /^\d{2}:\d{2}:\d{2}$/.test(v)
}

Try / catch

try {
  await saveRow(row)
} catch (e) {
  if (e instanceof HTTPError && e.status === 400 && /Time-only/.test(e.message)) {
    row.startTime = normaliseTime(row.startTime)
    await saveRow(row)
  } else throw e
}

Prevention

When it happens

Trigger: Saving a row, importing CSV, or API call where a timeOnly column receives "10:00" (missing seconds), "10:00:00 AM" (12-hour/meridiem), "10am", or an empty-ish non-time string.

Common situations: Spreadsheet time cells exporting as "10:00 AM"; HTML <input type="time"> values that omit seconds ("HH:MM"); UI form components for time pickers posting partial times.

Related errors


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/99fd227ab6d6a345. Report an issue: GitHub.