FlowiseAI/Flowise · warning · Error

Invalid namespace: must be at most ${RECORD_MANAGER_NAMESPAC

Error message

Invalid namespace: must be at most ${RECORD_MANAGER_NAMESPACE_MAX_LENGTH} characters

What it means

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.

Source

Thrown at packages/components/src/recordManagerSecurity.ts:32

    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

  1. Treat this as dead code: rely on the regex (or a single explicit length check) as the source of truth.
  2. 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.

Example fix

// current: regex {1,128} makes this branch dead code
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(`...`) // unreachable

// cleaner: separate concerns so both messages are reachable
if (!/^[a-zA-Z0-9_-]+$/.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`)
Defensive patterns

Strategy: validation

Validate before calling

// Length cap is already enforced by the {1,128} regex in sanitizeRecordManagerNamespace.
// Pre-check length only if you change that regex to drop the upper bound.
const willPassNamespaceLength = (s: string): boolean => s.trim().length <= 128

Type guard

const isValidNamespace = (s: string): boolean => /^[a-zA-Z0-9_-]{1,128}$/.test(s.trim())

Prevention

When it happens

Trigger: 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.

Common situations: Maintainers reading the code assume there are two distinct namespace errors; in production logs only 'Invalid namespace' (603) ever appears for over-length input.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/3f64ade1672eb703. Report an issue: GitHub.