{"record":{"id":"206b08d817ff4bc3","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-206b08","errorCode":null,"errorMessage":"invalid source for %q tool: source %q is not a compatible type","messagePattern":"invalid source for %q tool: source %q is not a compatible type","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/spanner/spannersearchcatalog/spannersearchcatalog.go","lineNumber":123,"sourceCode":"// validate interface\nvar _ tools.Tool = Tool{}\n\ntype Tool struct {\n\ttools.BaseTool[Config]\n}\n\nfunc (t Tool) GetSourceName() string {\n\treturn t.Cfg.Source\n}\n\nfunc (t Tool) ToConfig() tools.ToolConfig {\n\treturn t.Cfg\n}\n\nfunc (t Tool) ValidateSource(source sources.Source) error {\n\t_, ok := source.(compatibleSource)\n\tif !ok {\n\t\treturn fmt.Errorf(\"invalid source for %q tool: source %q is not a compatible type\", t.Cfg.Type, t.Cfg.Source)\n\t}\n\treturn nil\n}\n\nfunc (t Tool) RequiresClientAuthorization(source sources.Source) (bool, error) {\n\ts, ok := source.(compatibleSource)\n\tif !ok {\n\t\treturn false, fmt.Errorf(\"invalid source for %q tool: source %q is not a compatible type\", t.Cfg.Type, t.Cfg.Source)\n\t}\n\treturn s.UseClientAuthorization(), nil\n}\n\nfunc (t Tool) Invoke(ctx context.Context, s sources.Source, params parameters.ParamValues, accessToken tools.AccessToken) (any, util.ToolboxError) {\n\tsource, ok := s.(compatibleSource)\n\tif !ok {\n\t\treturn nil, util.NewClientServerError(\"source used is not compatible with the tool\", http.StatusInternalServerError, nil)\n\t}\n\tvar tokenStr string","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/spanner/spannersearchcatalog/spannersearchcatalog.go#L105-L141","documentation":"Tool.ValidateSource in spanner-search-catalog performs a type assertion of the provided source to compatibleSource (SpannerClient, DatabaseDialect, RunSQL). Sources that do not implement it cause this error, which surfaces when the toolbox validates the tool against its configured source.","triggerScenarios":"ValidateSource called with a non-Spanner source for a spanner-search-catalog tool — typically because the YAML `source:` points at another database's source.","commonSituations":"Wrong source kind in tools.yaml; refactors renaming sources so the tool binds to the wrong one; copying prebuilt spanner configs to non-Spanner setups.","solutions":["Point `source:` at a Spanner source (with SPANNER_SEARCH / search-index support for the catalog).","Verify the source implements compatibleSource before registering the tool.","Fix any renamed/duplicated source names in the config."],"exampleFix":"// before\nsearch-catalog:\n  kind: spanner-search-catalog\n  source: my-alloydb\n// after\nsearch-catalog:\n  kind: spanner-search-catalog\n  source: my-spanner","handlingStrategy":"type-guard","validationCode":"if _, ok := source.(compatibleSource); !ok {\n\treturn errors.New(\"spanner-search-catalog requires a Spanner source\")\n}","typeGuard":"cs, ok := source.(compatibleSource)\nif !ok { return errors.New(\"spanner-search-catalog needs a spanner compatibleSource\") }","tryCatchPattern":null,"preventionTips":["Bind search-catalog tools to Spanner sources with search indexes configured.","Validate the full config at startup; the error names the offending tool and source.","Review prebuilt-config source kinds before reuse."],"tags":["go","spanner","config","source-validation"],"backgroundTag":"incompatible-source-type","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"}