conductor-oss/conductor · error · RuntimeException

Invalid namespace

Error message

Invalid namespace

What it means

Thrown as a plain RuntimeException by MongoVectorDB.updateEmbeddings when the namespace fails the validation regex [a-zA-Z0-9_-]+. The regex guard prevents NoSQL/SQL injection via collection or namespace identifiers that are interpolated into queries. Only letters, digits, underscore, and hyphen are allowed; no dots, spaces, slashes, or empty strings.

Source

Thrown at ai/src/main/java/org/conductoross/conductor/ai/vectordb/mongodb/MongoVectorDB.java:82

        this.mongoDatabases =
                CacheBuilder.newBuilder()
                        .maximumSize(100)
                        .expireAfterAccess(Duration.ofSeconds(60))
                        .concurrencyLevel(32)
                        .build();
    }

    @Override
    public int updateEmbeddings(
            String indexName,
            String namespace,
            String doc,
            String parentDocId,
            String id,
            List<Float> embeddings,
            Map<String, Object> metadata) {
        if (!pattern.matcher(namespace).matches()) {
            throw new RuntimeException("Invalid namespace");
        }
        if (!pattern.matcher(indexName).matches()) {
            throw new RuntimeException("Invalid index name");
        }

        MongoClient client = null;
        MongoDatabase mongoDatabase = null;
        try {
            client = getClient();
            mongoDatabase = getDatabase(client);
            // assume collection exists and vector search index applied on it
            return upsertEmbeddings(
                    namespace, id, parentDocId, doc, embeddings, metadata, mongoDatabase);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Restrict namespace to [a-zA-Z0-9_-] characters only.
  2. Replace dots/spaces/special characters with underscores or hyphens before calling.
  3. Trim whitespace from the namespace input.
  4. Ensure the namespace is non-empty.

Example fix

// before
db.updateEmbeddings("idx", "my.namespace", ...);  // dot invalid
// after
db.updateEmbeddings("idx", "my_namespace", ...);
Defensive patterns

Strategy: validation

Validate before calling

private static final Pattern VALID = Pattern.compile("[a-zA-Z0-9_-]+");
// Validate before calling MongoVectorDB
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 containing dots (e.g. 'my.ns'), spaces, slashes, special characters, or an empty string to MongoVectorDB.updateEmbeddings.

Common situations: Using a dotted namespace convention from another store; passing a URL/UUID with dashes that also contains other chars; trailing/leading whitespace; an empty namespace defaulting from a missing input.

Related errors


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