{"record":{"id":"14545c4bde051779","repo":"googleapis/mcp-toolbox","slug":"must-provide-one-of-tns-alias-connection-stri","errorCode":null,"errorMessage":"must provide one of: 'tns_alias', 'connection_string', or both 'host' and 'service_name'","messagePattern":"must provide one of: 'tns_alias', 'connection_string', or both 'host' and 'service_name'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/oracle/oracle.go","lineNumber":81,"sourceCode":"\thasTnsAdmin := strings.TrimSpace(c.TnsAdmin) != \"\"\n\thasTnsAlias := strings.TrimSpace(c.TnsAlias) != \"\"\n\thasConnStr := strings.TrimSpace(c.ConnectionString) != \"\"\n\thasHostService := strings.TrimSpace(c.Host) != \"\" && strings.TrimSpace(c.ServiceName) != \"\"\n\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 {","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/oracle/oracle.go#L63-L99","documentation":"Oracle Config.validate counts the available connection methods (tnsAlias, connectionString, host+serviceName); if none is provided the source cannot build a connection and returns this explicit message.","triggerScenarios":"Declaring an Oracle source config with only credentials (user/password) or tnsAdmin but no tnsAlias, connectionString, or host+serviceName pair.","commonSituations":"Skeleton configs left unfilled; users assuming a tnsAdmin/wallet alone is enough to connect; deleted host field during refactoring.","solutions":["Add one connection method to the config: tnsAlias, or connectionString, or both host and serviceName","Verify YAML keys are correctly spelled and nested (not swallowed by indentation)","Confirm the decoded section actually receives these fields (matching yaml tags)"],"exampleFix":"// before\nkind: oracle\nuser: app\npassword: secret\n# no connection info\n// after\nkind: oracle\nuser: app\npassword: secret\nhost: db.example.com\nserviceName: ORCL","handlingStrategy":"validation","validationCode":"func hasConnectionMethod(cfg map[string]any) bool {\n    if _, ok := cfg[\"tnsAlias\"]; ok { return true }\n    if _, ok := cfg[\"connectionString\"]; ok { return true }\n    _, h := cfg[\"host\"]; _, s := cfg[\"serviceName\"]\n    return h && s\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check for host+serviceName as a pair, not alone","Confirm YAML keys are spelled per the schema","Never ship a credentials-only Oracle config","Fill all required fields from the official sample"],"tags":["configuration","oracle","missing-field"],"backgroundTag":"missing-connection-config","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"}