FlowiseAI/Flowise · error · Error

Invalid SQLite path: null bytes or control characters detect

Error message

Invalid SQLite path: null bytes or control characters detected

What it means

Thrown by validateSQLitePath (packages/components/src/validator.ts:343) when the SQLite path contains a NUL byte or any control character in 0x00-0x1f. Control chars can truncate or alter paths at the OS layer; Flowise rejects them outright.

Source

Thrown at packages/components/src/validator.ts:343

        if (!userProvidedPath || userProvidedPath.trim() === '') {
            return path.join(defaultDir, 'database.sqlite')
        }
        const bypassPath = userProvidedPath.trim()
        return path.isAbsolute(bypassPath) ? bypassPath : path.resolve(path.join(defaultDir, bypassPath))
    }

    if (!userProvidedPath || userProvidedPath.trim() === '') {
        throw new Error('Invalid SQLite path: database path is required')
    }

    const basePath = userProvidedPath.trim()

    if (basePath.includes('..')) throw new Error('Invalid SQLite path: path traversal attempt detected')
    if (basePath.toLowerCase().includes('%2e') || basePath.toLowerCase().includes('%2f') || basePath.toLowerCase().includes('%5c'))
        throw new Error('Invalid SQLite path: encoded path traversal attempt detected')
    // eslint-disable-next-line no-control-regex
    if (/\0/.test(basePath) || /[\x00-\x1f]/.test(basePath))
        throw new Error('Invalid SQLite path: null bytes or control characters detected')
    if (/^[a-zA-Z]:\\/.test(basePath)) throw new Error('Invalid SQLite path: Windows absolute paths are not allowed')
    if (/^\\\\[^\\]/.test(basePath)) throw new Error('Invalid SQLite path: UNC paths are not allowed')
    if (/^\\\\\?\\/.test(basePath)) throw new Error('Invalid SQLite path: extended-length paths are not allowed')

    const resolvedPath = path.isAbsolute(basePath) ? path.resolve(basePath) : path.resolve(path.join(defaultDir, basePath))

    if (resolvedPath.includes('..')) throw new Error('Invalid SQLite path: path traversal detected in resolved path')

    if (!isPathWithinAllowedSQLiteDirs(resolvedPath, allowedDirs)) {
        throw new Error(
            `Invalid SQLite path: path must be within allowed directories (${allowedDirs.join(', ')}). Attempted path: ${resolvedPath}`
        )
    }

    return resolvedPath
}

/**

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Strip control chars from input before assigning databasePath (replace /[\x00-\x1f]/g).
  2. Re-type the path by hand.
  3. Validate the value against /^[\x20-\x7e]+$/ at the boundary.

Example fix

// before
nodeParams.databasePath = rawInput   // stray \n

// after
nodeParams.databasePath = rawInput.replace(/[\x00-\x1f]/g, '').trim()
Defensive patterns

Strategy: validation

Validate before calling

if (/[\x00-\x1f]/.test(String(databasePath ?? ''))) throw new Error('control characters in DB path');

Type guard

const isPrintable = (p: unknown): p is string => typeof p === 'string' && /^[\x20-\x7e]+$/.test(p);

Try / catch

try { validateSQLitePath(databasePath) } catch (e) { if (e instanceof Error && /control characters/.test(e.message)) { databasePath = databasePath.replace(/[\x00-\x1f]/g, '') } else throw e }

Prevention

When it happens

Trigger: A Database Path value contains \0, tab, newline, or another control char — typically from binary input, terminal copy-paste, or an injected payload.

Common situations: Pasting paths from logs/terminals with invisible chars; raw multipart input bound without sanitization; random-string test fixtures.

Related errors


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