conductor-oss/conductor · error · RuntimeException

Invalid index name

Error message

Invalid index name

What it means

Thrown as a plain RuntimeException by MongoVectorDB.updateEmbeddings when indexName fails the validation regex [a-zA-Z0-9_-]+. Same injection-guard rationale as the namespace check, applied to the index/collection identifier. Only letters, digits, underscore, and hyphen are permitted.

Source

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

                        .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);
        }
    }

    private int upsertEmbeddings(
            String namespace,
            String id,

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Restrict indexName to [a-zA-Z0-9_-] characters.
  2. Sanitize dots/special characters to underscores before calling.
  3. Trim whitespace and ensure non-empty.
  4. Align index naming with the allowed character set across all call sites.

Example fix

// before
db.updateEmbeddings("my.index.name", "ns", ...);  // dots invalid
// after
db.updateEmbeddings("my_index_name", "ns", ...);
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Prevention

When it happens

Trigger: Passing an indexName with dots, spaces, slashes, special characters, or empty string to MongoVectorDB.updateEmbeddings.

Common situations: Index name sourced from a path or dotted config key; index name containing a project/environment separator like '.'; empty index defaulting from missing input; trailing whitespace.

Related errors


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