{"record":{"id":"efdfe31eb0a410bc","repo":"conductor-oss/conductor","slug":"invalid-index-name","errorCode":null,"errorMessage":"Invalid index name","messagePattern":"Invalid index name","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"ai/src/main/java/org/conductoross/conductor/ai/vectordb/mongodb/MongoVectorDB.java","lineNumber":85,"sourceCode":"                        .expireAfterAccess(Duration.ofSeconds(60))\n                        .concurrencyLevel(32)\n                        .build();\n    }\n\n    @Override\n    public int updateEmbeddings(\n            String indexName,\n            String namespace,\n            String doc,\n            String parentDocId,\n            String id,\n            List<Float> embeddings,\n            Map<String, Object> metadata) {\n        if (!pattern.matcher(namespace).matches()) {\n            throw new RuntimeException(\"Invalid namespace\");\n        }\n        if (!pattern.matcher(indexName).matches()) {\n            throw new RuntimeException(\"Invalid index name\");\n        }\n\n        MongoClient client = null;\n        MongoDatabase mongoDatabase = null;\n        try {\n            client = getClient();\n            mongoDatabase = getDatabase(client);\n            // assume collection exists and vector search index applied on it\n            return upsertEmbeddings(\n                    namespace, id, parentDocId, doc, embeddings, metadata, mongoDatabase);\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    private int upsertEmbeddings(\n            String namespace,\n            String id,","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/ai/src/main/java/org/conductoross/conductor/ai/vectordb/mongodb/MongoVectorDB.java#L67-L103","documentation":"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.","triggerScenarios":"Passing an indexName with dots, spaces, slashes, special characters, or empty string to MongoVectorDB.updateEmbeddings.","commonSituations":"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.","solutions":["Restrict indexName to [a-zA-Z0-9_-] characters.","Sanitize dots/special characters to underscores before calling.","Trim whitespace and ensure non-empty.","Align index naming with the allowed character set across all call sites."],"exampleFix":"// before\ndb.updateEmbeddings(\"my.index.name\", \"ns\", ...);  // dots invalid\n// after\ndb.updateEmbeddings(\"my_index_name\", \"ns\", ...);","handlingStrategy":"validation","validationCode":"private static final Pattern VALID = Pattern.compile(\"[a-zA-Z0-9_-]+\");\nif (!VALID.matcher(indexName).matches()) {\n    indexName = indexName.replaceAll(\"[^a-zA-Z0-9_-]\", \"_\");\n}","typeGuard":"boolean validIndex = indexName != null && Pattern.compile(\"[a-zA-Z0-9_-]+\").matcher(indexName).matches();","tryCatchPattern":null,"preventionTips":["Restrict index names to [a-zA-Z0-9_-] from the start.","Sanitize path/dotted identifiers into the allowed set.","Validate at ingest boundaries."],"tags":["mongodb","vectordb","validation","injection-guard"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}