{"record":{"id":"4cb13ae2ee945173","repo":"FlowiseAI/Flowise","slug":"invalid-namespace","errorCode":null,"errorMessage":"Invalid namespace","messagePattern":"Invalid namespace","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/src/recordManagerSecurity.ts","lineNumber":28,"sourceCode":"    if (!/^[a-zA-Z0-9_]+$/.test(tableName)) {\n        throw new Error('Invalid table name')\n    }\n\n    if (tableName.length > RECORD_MANAGER_TABLE_NAME_MAX_LENGTH) {\n        throw new Error(`Invalid table name: must be at most ${RECORD_MANAGER_TABLE_NAME_MAX_LENGTH} characters`)\n    }\n\n    return tableName\n}\n\n/**\n * Validates record manager namespace values stored in the database.\n */\nexport function sanitizeRecordManagerNamespace(namespace: string): string {\n    const trimmed = namespace.trim()\n\n    if (!/^[a-zA-Z0-9_-]{1,128}$/.test(trimmed)) {\n        throw new Error('Invalid namespace')\n    }\n\n    if (trimmed.length > RECORD_MANAGER_NAMESPACE_MAX_LENGTH) {\n        throw new Error(`Invalid namespace: must be at most ${RECORD_MANAGER_NAMESPACE_MAX_LENGTH} characters`)\n    }\n\n    return trimmed\n}\n","sourceCodeStart":10,"sourceCodeEnd":37,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/src/recordManagerSecurity.ts#L10-L37","documentation":"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.","triggerScenarios":"Passing '' (empty after trim), a value with spaces ('my ns'), slashes ('a/b'), colons, dots, quotes, or unicode characters.","commonSituations":"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.","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."],"exampleFix":"// before\nsanitizeRecordManagerNamespace('langchain/retriever:main') // throws 'Invalid namespace'\n\n// after\nconst ns = 'langchain/retriever:main'.replace(/[^A-Za-z0-9_-]+/g, '_')\nsanitizeRecordManagerNamespace(ns) // 'langchain_retriever_main'","handlingStrategy":"validation","validationCode":"function toValidNamespace(raw: string): string | null {\n  const n = raw.trim().replace(/[^A-Za-z0-9_-]/g, '_')\n  if (!n) return null\n  return n\n}","typeGuard":"const isValidNamespace = (s: string): boolean =>\n  /^[a-zA-Z0-9_-]{1,128}$/.test(s.trim())","tryCatchPattern":"try {\n  return sanitizeRecordManagerNamespace(input)\n} catch (e) {\n  throw new Error(`Namespace '${input}' is invalid: ${(e as Error).message}`, { cause: e })\n}","preventionTips":["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)."],"tags":["validation","record-manager","security"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}