conductor-oss/conductor · error · RuntimeException

Invalid namespace

Error message

Invalid namespace

What it means

Thrown as a plain RuntimeException by PostgresVectorDB.updateEmbeddings when namespace fails the validation regex [a-zA-Z0-9_-]+. This is the Postgres-side equivalent of the Mongo namespace guard; it prevents SQL injection since namespace is interpolated into the table name. Only letters, digits, underscore, and hyphen are allowed.

Source

Thrown at ai/src/main/java/org/conductoross/conductor/ai/vectordb/postgres/PostgresVectorDB.java:144

                        "Connection pool failed to start within " + maxWaitTime + "ms");
            }
        }
    }

    @Override
    public int updateEmbeddings(
            String indexName,
            String namespace,
            String doc,
            String parentDocId,
            String id,
            List<Float> embeddings,
            Map<String, Object> metadata) {
        if (parentDocId == null) {
            parentDocId = id;
        }
        if (!pattern.matcher(namespace).matches()) {
            throw new RuntimeException("Invalid namespace");
        }
        if (!pattern.matcher(indexName).matches()) {
            throw new RuntimeException("Invalid index name");
        }
        DataSource dataSource;
        try {
            // Assuming vector extension exists
            dataSource = getClient();
            // Wait for connection pool to be ready
            waitForConnectionPoolReady(dataSource);
        } catch (Exception exception) {
            log.error(
                    "Error encountered while fetching datasource : {}",
                    exception.getMessage(),
                    exception);
            throw new RuntimeException(exception);
        }

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Restrict namespace to [a-zA-Z0-9_-] characters only.
  2. Sanitize dots/special characters to underscores before calling (they become table-name fragments).
  3. Trim whitespace and ensure non-empty.
  4. Use the optional tablePrefix config instead of encoding structure into the namespace.

Example fix

// before
db.updateEmbeddings("idx", "schema.docs", ...);  // dot invalid
// after
db.updateEmbeddings("idx", "schema_docs", ...);
Defensive patterns

Strategy: validation

Validate before calling

private static final Pattern VALID = Pattern.compile("[a-zA-Z0-9_-]+");
if (!VALID.matcher(namespace).matches()) {
    namespace = namespace.replaceAll("[^a-zA-Z0-9_-]", "_");
}

Type guard

boolean validNamespace = namespace != null && Pattern.compile("[a-zA-Z0-9_-]+").matcher(namespace).matches();

Prevention

When it happens

Trigger: Passing a namespace with dots, spaces, slashes, special characters, or empty string to PostgresVectorDB.updateEmbeddings.

Common situations: Dotted namespace convention; namespace containing a table prefix separator like '.'; whitespace; empty namespace defaulting from missing input; cross-store naming incompatibility.

Related errors


AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14). Data as JSON: /api/errors/50cf67b4d8369660. Report an issue: GitHub.