{"record":{"id":"50cf67b4d8369660","repo":"conductor-oss/conductor","slug":"invalid-namespace-50cf67","errorCode":null,"errorMessage":"Invalid namespace","messagePattern":"Invalid namespace","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"ai/src/main/java/org/conductoross/conductor/ai/vectordb/postgres/PostgresVectorDB.java","lineNumber":144,"sourceCode":"                        \"Connection pool failed to start within \" + maxWaitTime + \"ms\");\n            }\n        }\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 (parentDocId == null) {\n            parentDocId = id;\n        }\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        DataSource dataSource;\n        try {\n            // Assuming vector extension exists\n            dataSource = getClient();\n            // Wait for connection pool to be ready\n            waitForConnectionPoolReady(dataSource);\n        } catch (Exception exception) {\n            log.error(\n                    \"Error encountered while fetching datasource : {}\",\n                    exception.getMessage(),\n                    exception);\n            throw new RuntimeException(exception);\n        }\n","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/ai/src/main/java/org/conductoross/conductor/ai/vectordb/postgres/PostgresVectorDB.java#L126-L162","documentation":"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.","triggerScenarios":"Passing a namespace with dots, spaces, slashes, special characters, or empty string to PostgresVectorDB.updateEmbeddings.","commonSituations":"Dotted namespace convention; namespace containing a table prefix separator like '.'; whitespace; empty namespace defaulting from missing input; cross-store naming incompatibility.","solutions":["Restrict namespace to [a-zA-Z0-9_-] characters only.","Sanitize dots/special characters to underscores before calling (they become table-name fragments).","Trim whitespace and ensure non-empty.","Use the optional tablePrefix config instead of encoding structure into the namespace."],"exampleFix":"// before\ndb.updateEmbeddings(\"idx\", \"schema.docs\", ...);  // dot invalid\n// after\ndb.updateEmbeddings(\"idx\", \"schema_docs\", ...);","handlingStrategy":"validation","validationCode":"private static final Pattern VALID = Pattern.compile(\"[a-zA-Z0-9_-]+\");\nif (!VALID.matcher(namespace).matches()) {\n    namespace = namespace.replaceAll(\"[^a-zA-Z0-9_-]\", \"_\");\n}","typeGuard":"boolean validNamespace = namespace != null && Pattern.compile(\"[a-zA-Z0-9_-]+\").matcher(namespace).matches();","tryCatchPattern":null,"preventionTips":["Use [a-zA-Z0-9_-] namespace names (they become table-name fragments).","Sanitize dotted identifiers to underscores.","Keep namespace identical between index and search paths."],"tags":["postgres","vectordb","validation","injection-guard","sql"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}