{"record":{"id":"5c295023d4b50041","repo":"googleapis/mcp-toolbox","slug":"invalid-oracle-configuration-w","errorCode":null,"errorMessage":"invalid Oracle configuration: %w","messagePattern":"invalid Oracle configuration: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/oracle/oracle.go","lineNumber":41,"sourceCode":"\n// validate interface\nvar _ sources.SourceConfig = Config{}\n\nfunc init() {\n\tif !sources.Register(SourceType, newConfig) {\n\t\tpanic(fmt.Sprintf(\"source type %q already registered\", SourceType))\n\t}\n}\n\nfunc newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources.SourceConfig, error) {\n\tactual := Config{Name: name}\n\tif err := decoder.DecodeContext(ctx, &actual); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Validate that we have one of: tnsAlias, connectionString, or host+service_name\n\tif err := actual.validate(); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid Oracle configuration: %w\", err)\n\t}\n\n\treturn actual, nil\n}\n\ntype Config struct {\n\tName             string `yaml:\"name\" validate:\"required\"`\n\tType             string `yaml:\"type\" validate:\"required\"`\n\tConnectionString string `yaml:\"connectionString,omitempty\"`\n\tTnsAlias         string `yaml:\"tnsAlias,omitempty\"`\n\tTnsAdmin         string `yaml:\"tnsAdmin,omitempty\"`\n\tHost             string `yaml:\"host,omitempty\"`\n\tPort             int    `yaml:\"port,omitempty\"`\n\tServiceName      string `yaml:\"serviceName,omitempty\"`\n\tUser             string `yaml:\"user\" validate:\"required\"`\n\tPassword         string `yaml:\"password\" validate:\"required\"`\n\tUseOCI           bool   `yaml:\"useOCI,omitempty\"`\n\tWalletLocation   string `yaml:\"walletLocation,omitempty\"`","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/oracle/oracle.go#L23-L59","documentation":"The Oracle source's newConfig decodes the user config and then runs validate(); any rule violation (missing or conflicting connection methods, wallet/tnsAdmin misuse) is surfaced as 'invalid Oracle configuration' wrapping the specific reason.","triggerScenarios":"Creating an Oracle source whose Config fails Config.validate(): no connection method, multiple connection methods, tnsAdmin without UseOCI, or wallet with UseOCI.","commonSituations":"Incomplete YAML missing connection fields; combining tns_alias with connection_string; copying a non-OCI config into an OCI setup or vice versa.","solutions":["Read the wrapped %w message for the exact violated rule","Provide exactly one connection method: tnsAlias, connectionString, or host+serviceName","Set UseOCI true when using tnsAdmin; use walletLocation for the non-OCI driver","Remove conflicting fields so only one connection method remains"],"exampleFix":"// before\nkind: oracle\nhost: db.example.com\ntnsAlias: ORCL  # two connection methods\n// after\nkind: oracle\nhost: db.example.com\nserviceName: ORCL","handlingStrategy":"validation","validationCode":"func oracleConfigValid(cfg map[string]any) error {\n    methods := 0\n    if cfg[\"tnsAlias\"] != nil { methods++ }\n    if cfg[\"connectionString\"] != nil { methods++ }\n    if cfg[\"host\"] != nil && cfg[\"serviceName\"] != nil { methods++ }\n    if methods == 0 { return fmt.Errorf(\"no connection method\") }\n    if methods > 1 { return fmt.Errorf(\"multiple connection methods\") }\n    if _, ok := cfg[\"tnsAdmin\"]; ok && cfg[\"useOCI\"] != true { return fmt.Errorf(\"tnsAdmin needs useOCI\") }\n    if _, ok := cfg[\"walletLocation\"]; ok && cfg[\"useOCI\"] == true { return fmt.Errorf(\"walletLocation conflicts with OCI\") }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep exactly one connection method in the config","Match wallet field (tnsAdmin vs walletLocation) to the driver mode","Lint Oracle configs before deployment","Start from the documented Oracle source example"],"tags":["configuration","oracle","validation"],"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"}