googleapis/mcp-toolbox · error

`tnsAdmin` can only be used when `UseOCI` is true, or use `w

Error message

`tnsAdmin` can only be used when `UseOCI` is true, or use `walletLocation` instead

What it means

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.

Source

Thrown at internal/sources/oracle/oracle.go:89

		connectionMethods++
	}
	if hasConnStr {
		connectionMethods++
	}
	if hasHostService {
		connectionMethods++
	}

	if connectionMethods == 0 {
		return fmt.Errorf("must provide one of: 'tns_alias', 'connection_string', or both 'host' and 'service_name'")
	}

	if connectionMethods > 1 {
		return fmt.Errorf("provide only one connection method: 'tns_alias', 'connection_string', or 'host'+'service_name'")
	}

	if hasTnsAdmin && !c.UseOCI {
		return fmt.Errorf("`tnsAdmin` can only be used when `UseOCI` is true, or use `walletLocation` instead")
	}

	if hasWallet && c.UseOCI {
		return fmt.Errorf("when using an OCI driver, use `tnsAdmin` to specify credentials file location instead")
	}

	return nil
}

func (r Config) SourceConfigType() string {
	return SourceType
}

func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {
	db, err := initOracleConnection(ctx, tracer, r)
	if err != nil {
		return nil, fmt.Errorf("unable to create Oracle connection: %w", err)
	}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Set useOCI: true in the source config to match tnsAdmin
  2. Move the wallet path to walletLocation if you intend to stay on the non-OCI driver
  3. Remove tnsAdmin if it is not needed

Example fix

// before
kind: oracle
tnsAdmin: /wallets/orcl
# useOCI not set
// after
kind: oracle
tnsAdmin: /wallets/orcl
useOCI: true
Defensive patterns

Strategy: validation

Validate before calling

func walletConfigOK(cfg map[string]any) bool {
    _, tns := cfg["tnsAdmin"]
    oci, _ := cfg["useOCI"].(bool)
    return !tns || oci
}

Prevention

When it happens

Trigger: Oracle config contains tnsAdmin but UseOCI is absent/false.

Common situations: Copy-pasting an OCI example without setting useOCI: true; forgetting the flag while keeping the wallet path under tnsAdmin.

Related errors


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/863ef6d4cb916530. Report an issue: GitHub.