{"record":{"id":"863ef6d4cb916530","repo":"googleapis/mcp-toolbox","slug":"tnsadmin-can-only-be-used-when-useoci-is-true","errorCode":null,"errorMessage":"`tnsAdmin` can only be used when `UseOCI` is true, or use `walletLocation` instead","messagePattern":"`tnsAdmin` can only be used when `UseOCI` is true, or use `walletLocation` instead","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/oracle/oracle.go","lineNumber":89,"sourceCode":"\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) {\n\tdb, err := initOracleConnection(ctx, tracer, r)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create Oracle connection: %w\", err)\n\t}","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/oracle/oracle.go#L71-L107","documentation":"tnsAdmin (a wallet directory) is only supported by the OCI Oracle driver path. When tnsAdmin is set but UseOCI is false, validate returns this message directing users to either enable UseOCI or use walletLocation for the non-OCI (godror-vs-go-ora style) driver.","triggerScenarios":"Oracle config contains tnsAdmin but UseOCI is absent/false.","commonSituations":"Copy-pasting an OCI example without setting useOCI: true; forgetting the flag while keeping the wallet path under tnsAdmin.","solutions":["Set useOCI: true in the source config to match tnsAdmin","Move the wallet path to walletLocation if you intend to stay on the non-OCI driver","Remove tnsAdmin if it is not needed"],"exampleFix":"// before\nkind: oracle\ntnsAdmin: /wallets/orcl\n# useOCI not set\n// after\nkind: oracle\ntnsAdmin: /wallets/orcl\nuseOCI: true","handlingStrategy":"validation","validationCode":"func walletConfigOK(cfg map[string]any) bool {\n    _, tns := cfg[\"tnsAdmin\"]\n    oci, _ := cfg[\"useOCI\"].(bool)\n    return !tns || oci\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set useOCI: true whenever tnsAdmin is used","Use walletLocation only for the non-OCI driver","Pair wallet fields with driver mode in config templates","Validate configs at startup, not at first query"],"tags":["configuration","oracle","wallet","oci"],"backgroundTag":"wallet-config-mismatch","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"}