{"record":{"id":"c6f745f07f117cee","repo":"googleapis/mcp-toolbox","slug":"provide-only-one-connection-method-tns-alias","errorCode":null,"errorMessage":"provide only one connection method: 'tns_alias', 'connection_string', or 'host'+'service_name'","messagePattern":"provide only one connection method: 'tns_alias', 'connection_string', or 'host'\\+'service_name'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/oracle/oracle.go","lineNumber":85,"sourceCode":"\thasWallet := strings.TrimSpace(c.WalletLocation) != \"\"\n\n\tconnectionMethods := 0\n\tif hasTnsAlias {\n\t\tconnectionMethods++\n\t}\n\tif hasConnStr {\n\t\tconnectionMethods++\n\t}\n\tif hasHostService {\n\t\tconnectionMethods++\n\t}\n\n\tif connectionMethods == 0 {\n\t\treturn fmt.Errorf(\"must provide one of: 'tns_alias', 'connection_string', or both 'host' and 'service_name'\")\n\t}\n\n\tif connectionMethods > 1 {\n\t\treturn fmt.Errorf(\"provide only one connection method: 'tns_alias', 'connection_string', or 'host'+'service_name'\")\n\t}\n\n\tif hasTnsAdmin && !c.UseOCI {\n\t\treturn fmt.Errorf(\"`tnsAdmin` can only be used when `UseOCI` is true, or use `walletLocation` instead\")\n\t}\n\n\tif hasWallet && c.UseOCI {\n\t\treturn fmt.Errorf(\"when using an OCI driver, use `tnsAdmin` to specify credentials file location instead\")\n\t}\n\n\treturn nil\n}\n\nfunc (r Config) SourceConfigType() string {\n\treturn SourceType\n}\n\nfunc (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/oracle/oracle.go#L67-L103","documentation":"If the Oracle config supplies more than one of tnsAlias, connectionString, or host+serviceName, validate rejects the ambiguity with this message, since the source cannot decide which connection method to use.","triggerScenarios":"Setting both tnsAlias and connectionString, or a connectionString plus host/serviceName, in the same Oracle source config.","commonSituations":"Merging two example configs together; adding host/service overrides while a connectionString already exists; leftover fields from a previous connection style.","solutions":["Keep exactly one connection method and delete the others","Prefer connectionString for full control, or host+serviceName for simple setups","Use tnsAlias only when a tnsAdmin wallet (OCI) or walletLocation supplies the TNS mapping"],"exampleFix":"// before\nkind: oracle\ntnsAlias: ORCL\nconnectionString: db.example.com:1521/ORCL\n// after\nkind: oracle\ntnsAlias: ORCL\nuseOCI: true\ntnsAdmin: /path/to/wallet","handlingStrategy":"validation","validationCode":"func oneConnectionMethod(cfg map[string]any) bool {\n    n := 0\n    if _, ok := cfg[\"tnsAlias\"]; ok { n++ }\n    if _, ok := cfg[\"connectionString\"]; ok { n++ }\n    if _, ok := cfg[\"host\"]; ok { n++ }\n    return n <= 1\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Delete unused connection fields after switching methods","Avoid merging multiple Oracle config examples","Document which connection style your team standardizes on","Review diffs on source configs for stray fields"],"tags":["configuration","oracle","ambiguous-config"],"backgroundTag":"invalid-config-value","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}