{"record":{"id":"3f64ade1672eb703","repo":"FlowiseAI/Flowise","slug":"invalid-namespace-must-be-at-most-record-manage","errorCode":null,"errorMessage":"Invalid namespace: must be at most ${RECORD_MANAGER_NAMESPACE_MAX_LENGTH} characters","messagePattern":"Invalid namespace: must be at most (.+?) characters","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/components/src/recordManagerSecurity.ts","lineNumber":32,"sourceCode":"    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":14,"sourceCodeEnd":37,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/src/recordManagerSecurity.ts#L14-L37","documentation":"This branch checks trimmed.length > RECORD_MANAGER_NAMESPACE_MAX_LENGTH (128). IMPORTANT: it is effectively UNREACHABLE today because the preceding regex on line 27 already caps matches at {1,128}, so any input over 128 chars fails the regex and throws 'Invalid namespace' (error 603) first. In practice you will never see this specific 'must be at most ... characters' message for namespaces; only table names (error 602) have a reachable length branch.","triggerScenarios":"Not reachable with the current code: any >128-char namespace is rejected by the {1,128} quantifier in the regex on line 27 before this branch runs. Would only fire if that regex's upper bound were removed.","commonSituations":"Maintainers reading the code assume there are two distinct namespace errors; in production logs only 'Invalid namespace' (603) ever appears for over-length input.","solutions":["Treat this as dead code: rely on the regex (or a single explicit length check) as the source of truth.","If you maintain this file, either drop the redundant branch or split the regex into a pure char-class check plus an explicit length check so both messages become reachable and intentional."],"exampleFix":"// current: regex {1,128} makes this branch dead code\nif (!/^[a-zA-Z0-9_-]{1,128}$/.test(trimmed)) throw new Error('Invalid namespace')\nif (trimmed.length > RECORD_MANAGER_NAMESPACE_MAX_LENGTH) throw new Error(`...`) // unreachable\n\n// cleaner: separate concerns so both messages are reachable\nif (!/^[a-zA-Z0-9_-]+$/.test(trimmed)) throw new Error('Invalid namespace')\nif (trimmed.length > RECORD_MANAGER_NAMESPACE_MAX_LENGTH) throw new Error(`Invalid namespace: must be at most ${RECORD_MANAGER_NAMESPACE_MAX_LENGTH} characters`)","handlingStrategy":"validation","validationCode":"// Length cap is already enforced by the {1,128} regex in sanitizeRecordManagerNamespace.\n// Pre-check length only if you change that regex to drop the upper bound.\nconst willPassNamespaceLength = (s: string): boolean => s.trim().length <= 128","typeGuard":"const isValidNamespace = (s: string): boolean => /^[a-zA-Z0-9_-]{1,128}$/.test(s.trim())","tryCatchPattern":null,"preventionTips":["Treat the length branch as dead code: the regex on line 27 rejects >128-char namespaces first (you'll see 'Invalid namespace', not this message).","If you maintain this file, split char-class and length checks so both messages are reachable and intentional."],"tags":["validation","dead-code","record-manager","maintenance"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}