FlowiseAI/Flowise · error · Error

Invalid table name

Error message

Invalid table name

What it means

Thrown by `VectorStoreDriver.sanitizeTableName` when, after trimming, lowercasing, and whitespace→underscore normalization, the table name does not match `^[a-zA-Z0-9_]+$`. Only ASCII letters, digits, and underscores are permitted; spaces are pre-normalized but any other punctuation (hyphen, dot, slash, unicode) fails validation.

Source

Thrown at packages/components/nodes/vectorstores/Postgres/driver/Base.ts:60

    getTablePath() {
        const schemaName = this.getSchemaName()
        const tableName = this.getTableName()
        if (!schemaName) return `"${tableName}"`
        return `"${schemaName}"."${tableName}"`
    }

    getEmbeddings() {
        return this.nodeData.inputs?.embeddings as Embeddings
    }

    sanitizeTableName(tableName: string): string {
        // Trim and normalize case, turn whitespace into underscores
        tableName = tableName.trim().toLowerCase().replace(/\s+/g, '_')

        // Validate using a regex (alphanumeric and underscores only)
        if (!/^[a-zA-Z0-9_]+$/.test(tableName)) {
            throw new Error('Invalid table name')
        }

        return tableName
    }

    async getCredentials() {
        const credentialData = await getCredentialData(this.nodeData.credential ?? '', this.options)
        const user = getCredentialParam('user', credentialData, this.nodeData, process.env.POSTGRES_VECTORSTORE_USER)
        const password = getCredentialParam('password', credentialData, this.nodeData, process.env.POSTGRES_VECTORSTORE_PASSWORD)

        return {
            user,
            password
        }
    }
}

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Use a table name with only letters, digits, and underscores (e.g. `my_docs`).
  2. Move any schema qualifier into the dedicated schema-name field, not the table name.
  3. Pre-sanitize generated names (strip/replace non-word characters) before passing them in.
  4. Avoid leading digits if you also want broad compatibility (regex allows them but some tools do not).

Example fix

// before — input 'my-docs' or 'public.docs' fails
const name = nodeData.inputs?.tableName // 'my-docs'
// after — sanitize at the source
const raw = (nodeData.inputs?.tableName ?? 'documents').trim()
const name = raw.toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/^_+|_+$/g, '') || 'documents'
Defensive patterns

Strategy: validation

Validate before calling

function sanitizeName(raw: string, fallback = 'documents'): string {
  const n = raw.trim().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/^_+|_+$/g, '')
  if (!/^[a-z0-9_]+$/.test(n)) return fallback
  return n
}

Type guard

function isValidTableName(name: string): boolean {
  return /^[a-zA-Z0-9_]+$/.test(name.trim().toLowerCase().replace(/\s+/g, '_'))
}

Try / catch

const safe = sanitizeName(rawTableName)
if (!isValidTableName(safe)) throw new Error(`Refusing invalid table name: '${rawTableName}'`)
nodeData.inputs.tableName = safe

Prevention

When it happens

Trigger: User supplies a table name containing hyphens (e.g. `my-docs`), dots (`schema.table`), slashes, parentheses, or non-ASCII characters. Schema-qualified input here also fails because the dot is rejected.

Common situations: Default table name templated from a node label that includes spaces or hyphens; copy-paste of a fully-qualified `schema.table` into the table-name field (schema goes in a separate field); unicode in non-English workspace names.

Related errors


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