FlowiseAI/Flowise · error · Error
Invalid namespace
Error message
Invalid namespace
What it means
sanitizeRecordManagerNamespace trims the input then requires ^[a-zA-Z0-9_-]{1,128}$. Empty input or any character outside ASCII alphanumerics, underscore, or hyphen throws 'Invalid namespace'. Namespaces are stored values (not SQL identifiers), so hyphens are permitted here, unlike table names.
Source
Thrown at packages/components/src/recordManagerSecurity.ts:28
if (!/^[a-zA-Z0-9_]+$/.test(tableName)) {
throw new Error('Invalid table name')
}
if (tableName.length > RECORD_MANAGER_TABLE_NAME_MAX_LENGTH) {
throw new Error(`Invalid table name: must be at most ${RECORD_MANAGER_TABLE_NAME_MAX_LENGTH} characters`)
}
return tableName
}
/**
* Validates record manager namespace values stored in the database.
*/
export function sanitizeRecordManagerNamespace(namespace: string): string {
const trimmed = namespace.trim()
if (!/^[a-zA-Z0-9_-]{1,128}$/.test(trimmed)) {
throw new Error('Invalid namespace')
}
if (trimmed.length > RECORD_MANAGER_NAMESPACE_MAX_LENGTH) {
throw new Error(`Invalid namespace: must be at most ${RECORD_MANAGER_NAMESPACE_MAX_LENGTH} characters`)
}
return trimmed
}
View on GitHub (pinned to abe4a8601a)
Solutions
- Ensure the namespace is non-empty after trimming.
- Restrict to [A-Za-z0-9_-] upstream; replace disallowed chars with '_' or '-'.
- Do not pass paths or URLs as namespaces; map them to a short slug first.
Example fix
// before
sanitizeRecordManagerNamespace('langchain/retriever:main') // throws 'Invalid namespace'
// after
const ns = 'langchain/retriever:main'.replace(/[^A-Za-z0-9_-]+/g, '_')
sanitizeRecordManagerNamespace(ns) // 'langchain_retriever_main' Defensive patterns
Strategy: validation
Validate before calling
function toValidNamespace(raw: string): string | null {
const n = raw.trim().replace(/[^A-Za-z0-9_-]/g, '_')
if (!n) return null
return n
} Type guard
const isValidNamespace = (s: string): boolean =>
/^[a-zA-Z0-9_-]{1,128}$/.test(s.trim()) Try / catch
try {
return sanitizeRecordManagerNamespace(input)
} catch (e) {
throw new Error(`Namespace '${input}' is invalid: ${(e as Error).message}`, { cause: e })
} Prevention
- Never pass URLs, file paths, or ARNs as namespaces; map them to a slug first.
- Ensure namespaces are non-empty after trimming at the input layer.
- Hyphens are allowed here (unlike table names).
When it happens
Trigger: Passing '' (empty after trim), a value with spaces ('my ns'), slashes ('a/b'), colons, dots, quotes, or unicode characters.
Common situations: Using a URL, file path, or ARN as the namespace; forgetting to set a namespace so it arrives as empty string; injecting display names with spaces.
Related errors
- Invalid table name
- Invalid JSON in the Additional Configuration: ${exception}
- Invalid table name
- Number of keys (${keyStrings.length}) does not match number
- Number of keys (${keyStrings.length}) does not match number
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/4cb13ae2ee945173.
Report an issue: GitHub.