{"record":{"id":"4c2330c6809503b8","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-4c2330","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/bigtable/bigtablesql/bigtablesql.go","lineNumber":106,"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) 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\tparamsMap := params.AsMap()\n\tnewStatement, err := parameters.ResolveTemplateParams(t.Cfg.TemplateParameters, t.Cfg.Statement, paramsMap)\n\tif err != nil {\n\t\treturn nil, util.NewAgentError(\"unable to extract template params\", err)\n\t}\n\n\tnewParams, err := parameters.GetParams(t.Cfg.Parameters, paramsMap)\n\tif err != nil {\n\t\treturn nil, util.NewAgentError(\"unable to extract standard params\", err)","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/bigtable/bigtablesql/bigtablesql.go#L88-L124","documentation":"Thrown by the bigtablesql Tool.ValidateSource when the sources.Source passed to the tool does not implement the compatibleSource interface expected by this tool. It catches wiring a tool to a source of the wrong kind at runtime before any query executes.","triggerScenarios":"Invoke/ValidateSource is called with a source whose concrete type does not satisfy bigtablesql's compatibleSource interface — e.g. the tool's source field points at a Postgres or non-Bigtable source in tools.yaml, or code passes the wrong Source into Invoke.","commonSituations":"Copy-pasting a tool block and leaving the source key pointing at a different database; renaming sources and forgetting to update the tool; programmatically constructing tool/source pairs mismatched after a config refactor.","solutions":["Set the tool's source field to a bigtable source kind in tools.yaml","Verify the referenced source name exists and its kind initializes as a Bigtable-compatible source","Rebuild/restart the toolbox so the new source-tool pairing is loaded","If calling Invoke programmatically, pass the Source returned by the bigtable source's Initialize, not another source"],"exampleFix":"// before (tools.yaml)\nsources:\n  my-db:\n    kind: postgres\n    uri: ...\ntools:\n  execute-sql:\n    kind: bigtable-sql\n    source: my-db\n// after\nsources:\n  my-bigtable:\n    kind: bigtable\n    project: my-project\n    instance: my-instance\ntools:\n  execute-sql:\n    kind: bigtable-sql\n    source: my-bigtable","handlingStrategy":"type-guard","validationCode":"// Before wiring the tool, assert the source implements the tool's interface\nvar _ sources.Source = mySource\nif _, ok := mySource.(bigtablesql.CompatibleSource); !ok {\n    return fmt.Errorf(\"source %s is not compatible with bigtable-sql\", sourceName)\n}","typeGuard":"func isCompatibleBigtableSQLSource(s sources.Source) (bigtablesql.CompatibleSource, bool) {\n    cs, ok := s.(bigtablesql.CompatibleSource)\n    return cs, ok\n}","tryCatchPattern":null,"preventionTips":["Keep the tool's source field pointing at a source of the matching kind (bigtable)","After renaming sources, grep tools.yaml for stale source references","Validate the full config at startup; the toolbox validates source-tool pairs before serving","Do not copy tool blocks across sources of different kinds without updating source"],"tags":["go","config","type-mismatch","bigtable"],"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"}