googleapis/mcp-toolbox · error
invalid Oracle configuration: %w
Error message
invalid Oracle configuration: %w
What it means
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.
Source
Thrown at internal/sources/oracle/oracle.go:41
// validate interface
var _ sources.SourceConfig = Config{}
func init() {
if !sources.Register(SourceType, newConfig) {
panic(fmt.Sprintf("source type %q already registered", SourceType))
}
}
func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources.SourceConfig, error) {
actual := Config{Name: name}
if err := decoder.DecodeContext(ctx, &actual); err != nil {
return nil, err
}
// Validate that we have one of: tnsAlias, connectionString, or host+service_name
if err := actual.validate(); err != nil {
return nil, fmt.Errorf("invalid Oracle configuration: %w", err)
}
return actual, nil
}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"type" validate:"required"`
ConnectionString string `yaml:"connectionString,omitempty"`
TnsAlias string `yaml:"tnsAlias,omitempty"`
TnsAdmin string `yaml:"tnsAdmin,omitempty"`
Host string `yaml:"host,omitempty"`
Port int `yaml:"port,omitempty"`
ServiceName string `yaml:"serviceName,omitempty"`
User string `yaml:"user" validate:"required"`
Password string `yaml:"password" validate:"required"`
UseOCI bool `yaml:"useOCI,omitempty"`
WalletLocation string `yaml:"walletLocation,omitempty"`View on GitHub (pinned to 8cc6e09de2)
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
Example fix
// before kind: oracle host: db.example.com tnsAlias: ORCL # two connection methods // after kind: oracle host: db.example.com serviceName: ORCL
Defensive patterns
Strategy: validation
Validate before calling
func oracleConfigValid(cfg map[string]any) error {
methods := 0
if cfg["tnsAlias"] != nil { methods++ }
if cfg["connectionString"] != nil { methods++ }
if cfg["host"] != nil && cfg["serviceName"] != nil { methods++ }
if methods == 0 { return fmt.Errorf("no connection method") }
if methods > 1 { return fmt.Errorf("multiple connection methods") }
if _, ok := cfg["tnsAdmin"]; ok && cfg["useOCI"] != true { return fmt.Errorf("tnsAdmin needs useOCI") }
if _, ok := cfg["walletLocation"]; ok && cfg["useOCI"] == true { return fmt.Errorf("walletLocation conflicts with OCI") }
return nil
} Prevention
- 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
When it happens
Trigger: Creating an Oracle source whose Config fails Config.validate(): no connection method, multiple connection methods, tnsAdmin without UseOCI, or wallet with UseOCI.
Common situations: Incomplete YAML missing connection fields; combining tns_alias with connection_string; copying a non-OCI config into an OCI setup or vice versa.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- `introspectionEndpoint` is not allowed when `mcpEnabled` is
- `introspectionMethod` is not allowed when `mcpEnabled` is fa
- `introspectionParamName` is not allowed when `mcpEnabled` is
- error parsing argument: %w
- invalid role %q: must be 'user' or 'assistant'
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/5c295023d4b50041.
Report an issue: GitHub.