Budibase/budibase · error
Cannot process non-string types.
Error message
Cannot process non-string types.
What it means
processStringSyncInternal in packages/string-templates/src/index.ts requires its first argument to be a string template. If anything else (null, undefined, a number, an object) is passed to processStringSync or processStringWithLogsSync, it throws "Cannot process non-string types." immediately, before creating a copy of the input for error reporting.
Source
Thrown at packages/string-templates/src/index.ts:214
function processStringSyncInternal(
str: string,
context?: object,
opts?: ProcessOptions & { logging: false }
): string
function processStringSyncInternal(
str: string,
context?: object,
opts?: ProcessOptions & { logging: true }
): { result: string; logs: Log[] }
function processStringSyncInternal(
string: string,
context?: object,
opts?: ProcessOptions & { logging: boolean }
): string | { result: string; logs: Log[] } {
// Take a copy of input in case of error
const input = string
if (typeof string !== "string") {
throw new Error("Cannot process non-string types.")
}
function process(stringPart: string) {
// context is needed to check for overlap between helpers and context
const template = createTemplate(stringPart, opts, context)
const now = Math.floor(Date.now() / 1000) * 1000
const processedString = template({
now: new Date(now).toISOString(),
__opts: {
...opts,
input: stringPart,
},
...context,
})
return opts?.logging
? postprocessWithLogs(processedString)
: postprocess(processedString)
}
try {View on GitHub (pinned to a81a902e9a)
Solutions
- Check typeof template === "string" before calling, and substitute a default (e.g. "" or a placeholder).
- Coerce known-safe values with String(value) when a string template is genuinely expected.
- Make the template field required in your automation/step configuration so it can't be null.
- Fix upstream data so the template input is populated.
Example fix
// before const out = processStringSync(automation.template, context) // after const out = typeof automation.template === "string" ? processStringSync(automation.template, context) : ""
Defensive patterns
Strategy: type-guard
Validate before calling
function safeProcess(template: unknown, ctx: object): string {
if (typeof template !== "string") return ""
return processStringSync(template, ctx)
} Type guard
function isTemplate(v: unknown): v is string {
return typeof v === "string"
} Try / catch
let out: string
try {
out = processStringSync(template, context)
} catch (e) {
if (e.message === "Cannot process non-string types.") {
out = ""
} else throw e
} Prevention
- Coerce or default template inputs (?? "") at boundaries where data may be null
- Mark template fields as required in automation/step schemas
- Type parameters as string so TypeScript catches undefined at compile time
- Validate JSON-derived inputs before passing into string-templates
When it happens
Trigger: Calling processStringSync(undefined, ctx), passing a number or object instead of a template string, or piping a value that can be null (e.g. a missing automation/binding input) straight into the processor.
Common situations: Automations where a template field is empty/missing at runtime; REST/JS steps binding null request bodies into templates; TypeScript callers bypassing types with data from untyped JSON; refactors that changed a variable from string to optional.
Related errors
- Parameter '${key}' input contains a handlebars binding - thi
- Multi-object JSON templates must be valid JSON objects
- Error getting status
- Unable to remove doc without a valid _id and _rev.
- Cannot store document without _id field.
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/6f3c727b8d5d02dc.
Report an issue: GitHub.