{"record":{"id":"c969406018c07e3a","repo":"apache/seatunnel","slug":"azurecosmosdb-requires-uri-endpoint-or-connectio","errorCode":null,"errorMessage":"AzureCosmosDB requires uri, endpoint, or connection string to resolve the endpoint","messagePattern":"AzureCosmosDB requires uri, endpoint, or connection string to resolve the endpoint","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-azurecosmosdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/azurecosmosdb/config/AzureCosmosDBConfig.java","lineNumber":68,"sourceCode":"                config.getOptional(AzureCosmosDBSourceOptions.SECONDARY_KEY).orElse(null);\n        this.primaryConnectionString =\n                config.getOptional(AzureCosmosDBSourceOptions.PRIMARY_CONNECTION_STRING)\n                        .orElse(null);\n        this.secondaryConnectionString =\n                config.getOptional(AzureCosmosDBSourceOptions.SECONDARY_CONNECTION_STRING)\n                        .orElse(null);\n        this.database = config.get(AzureCosmosDBSourceOptions.DATABASE);\n        this.container = config.get(AzureCosmosDBSourceOptions.CONTAINER);\n        this.query = config.get(AzureCosmosDBSourceOptions.QUERY);\n        this.maxItemCount = config.get(AzureCosmosDBSourceOptions.MAX_ITEM_COUNT);\n        this.schema =\n                config.getOptional(ConnectorCommonOptions.SCHEMA)\n                        .map(ReadonlyConfig::fromMap)\n                        .map(ReadonlyConfig::toConfig)\n                        .orElse(null);\n\n        if (getResolvedEndpoint() == null) {\n            throw new IllegalArgumentException(\n                    \"AzureCosmosDB requires uri, endpoint, or connection string to resolve the endpoint\");\n        }\n        if (getResolvedKey() == null) {\n            throw new IllegalArgumentException(\n                    \"AzureCosmosDB requires key, primary_key, secondary_key, or a connection string to resolve the key\");\n        }\n    }\n\n    public String getResolvedEndpoint() {\n        String resolvedEndpoint = firstNonBlank(uri, endpoint);\n        if (resolvedEndpoint != null) {\n            return resolvedEndpoint;\n        }\n\n        return firstNonBlank(\n                parseConnectionString(primaryConnectionString).get(\"endpoint\"),\n                parseConnectionString(secondaryConnectionString).get(\"endpoint\"));\n    }","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-azurecosmosdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/azurecosmosdb/config/AzureCosmosDBConfig.java#L50-L86","documentation":"AzureCosmosDBConfig validates at construction time that the connector can determine which Cosmos DB account endpoint to talk to. It resolves the endpoint from the `uri` or `endpoint` options, falling back to parsing a `connectionString`; if all are absent, it throws IllegalArgumentException before any network call is made.","triggerScenarios":"Creating the connector config (e.g. via AzureCosmosDBSource/Sink factory or ReadonlyConfig conversion) when neither `uri`, `endpoint`, nor `connectionString` is set in the job config.","commonSituations":"User forgot the uri/endpoint option entirely; option name typo (e.g. `url` instead of `uri`); config loaded from an HOCON map missing the cosmos section; a placeholder value left empty after templating.","solutions":["Add `uri = \"https://<account>.documents.azure.com:443/\"` to the CosmosDB source/sink config","Or set `endpoint` with the account endpoint URL","Or set `connectionString` (AccountEndpoint/AccountKey format) and let the connector parse both endpoint and key","Verify the HOCON/env config actually passes the option through (check ReadonlyConfig keys, typos, and placeholder substitution)"],"exampleFix":"// before\nsource {\n  AzureCosmosDB {\n    database = \"shop\"\n    container = \"orders\"\n  }\n}\n// after\nsource {\n  AzureCosmosDB {\n    uri = \"https://myaccount.documents.azure.com:443/\"\n    key = \"<account-key>\"\n    database = \"shop\"\n    container = \"orders\"\n  }\n}","handlingStrategy":"validation","validationCode":"boolean hasEndpoint = cfg.getOptional(AzureCosmosDBConfig.URI).isPresent()\n    || cfg.getOptional(AzureCosmosDBConfig.ENDPOINT).isPresent()\n    || cfg.getOptional(AzureCosmosDBConfig.CONNECTION_STRING).isPresent();\nif (!hasEndpoint) throw new IllegalArgumentException(\"Set uri, endpoint, or connectionString for AzureCosmosDB\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always configure `uri` (or `connectionString`) in every CosmosDB source/sink block","Use a shared config template so endpoint options are never omitted","Validate configs with a dry-run job before production"],"tags":["config","azure-cosmosdb","validation","missing-option"],"backgroundTag":"missing-required-config-field","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}