FlowiseAI/Flowise · error · Error
${e}
Error message
${e} What it means
Top-level catch around executeJavaScriptCode in CustomDocumentLoader. It re-wraps any thrown value as new Error(e). If e is an Error, new Error(errorObject) calls errorObject.toString() so the original stack and name (SyntaxError, ReferenceError, etc.) are flattened into a generic Error message. This also re-wraps the [110] contract error, masking which check failed.
Source
Thrown at packages/components/nodes/documentloaders/CustomDocumentLoader/CustomDocumentLoader.ts:143
if (output === 'document' && Array.isArray(response)) {
if (response.length === 0) return response
if (
response[0].pageContent &&
typeof response[0].pageContent === 'string' &&
response[0].metadata &&
typeof response[0].metadata === 'object'
)
return response
throw new Error('Document object must contain pageContent and metadata')
}
if (output === 'text' && typeof response === 'string') {
return handleEscapeCharacters(response, false)
}
return response
} catch (e) {
throw new Error(e)
}
}
}
module.exports = { nodeClass: CustomDocumentLoader_DocumentLoaders }
View on GitHub (pinned to abe4a8601a)
Solutions
- Read the message text carefully - it usually contains the underlying error string even though the type is lost.
- If the message matches 'Document object must contain pageContent and metadata', the root cause is the shape contract (see error 110).
- Wrap your sandbox body in its own try/catch and throw a descriptive Error so the outer wrapper has something useful to re-wrap.
- Run the function body in Node with the same inputs to reproduce the underlying exception with its real stack.
Example fix
// before
} catch (e) {
throw new Error(e)
}
// after - preserve the original error chain
} catch (e) {
if (e instanceof Error) throw e
throw new Error(typeof e === 'string' ? e : JSON.stringify(e))
} Defensive patterns
Strategy: try-catch
Validate before calling
function validateSandboxSource(fn: string): void {
if (typeof fn !== 'string' || fn.trim() === '') throw new Error('javascriptFunction input is empty')
// basic balance check to catch SyntaxError early
const open = (fn.match(/[({[]/g) || []).length
const close = (fn.match(/[)}\]]/g) || []).length
if (open !== close) throw new Error(`javascriptFunction has unbalanced brackets: ${open} open vs ${close} close`)
}
// validateSandboxSource(nodeData.inputs?.javascriptFunction) before executeJavaScriptCode Type guard
function isErrorWithMessage(e: unknown): e is Error {
return e instanceof Error || (typeof e === 'object' && e !== null && 'message' in e)
} Try / catch
try {
const result = await executeJavaScriptCode(javascriptFunction, sandbox, { libraries: ['axios'] })
return result
} catch (e) {
// The outer wrapper flattens e to a string message; parse it back
const msg = e instanceof Error ? e.message : String(e)
if (/is not defined/.test(msg)) throw new Error(`Sandbox ReferenceError: ${msg}. Allowed vars: input, $<inputVars>, flow, vars.`)
throw e
} Prevention
- Only reference sandbox-allowed variables (input, flow, vars, $<inputVar>).
- Only import libraries explicitly allowed (['axios']); others will throw.
- Validate your function in plain Node with the same inputs first.
When it happens
Trigger: Sandbox function threw a ReferenceError (undefined variable), SyntaxError (bad JS), TypeError, or timed out; the contract check at [110] threw and was re-caught here.
Common situations: User code has a typo or references an undefined sandbox variable; the function references a library not in the allowed list (['axios']); an exception from the document-shape check gets flattened so the user sees only 'Error: ...'.
Related errors
- Document object must contain pageContent and metadata
- ${e}
- ${e}
- ${e}
- Failed to fetch ${url} from Airtable: ${error}
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/9c8477cde2450015.
Report an issue: GitHub.