{"record":{"id":"58215938d8d9f093","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-582159","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/sqlite/sqlitesql/sqlitesql.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/sqlite/sqlitesql/sqlitesql.go#L88-L124","documentation":"sqlite-sql's ValidateSource performs the same interface assertion: the source must implement compatibleSource (SQLite-backed). A tool bound to a non-SQLite source (or any unrelated sources.Source) fails the assertion and this error is returned before Invoke runs.","triggerScenarios":"`sqlite-sql` tool's `source:` references a postgres/mysql/spanner/other source; direct Go call to ValidateSource with a mismatched source.","commonSituations":"Copy-pasting tool blocks between source sections without changing the `source` field; consolidating configs for multiple databases.","solutions":["Set the tool's `source:` to a `kind: sqlite` source.","Create the sqlite source if missing.","Add automated cross-checks between tool kinds and source kinds."],"exampleFix":"# before\nsource: cloud-sql-pg\n# after\nsource: local-sqlite","handlingStrategy":"type-guard","validationCode":"# ensure source kind matches tool engine\nyq '.tools[] | select(.kind == \"sqlite-sql\") | .source as $s | ., (\"kind=\" + .sources[$s].kind)' tools.yaml","typeGuard":"func isSQLiteSource(s sources.Source) bool {\n    _, ok := s.(sqlitesql.CompatibleSource)\n    return ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    log.Fatalf(\"tool/source engine mismatch: %v\", err)\n}","preventionTips":["Audit tools.yaml pairing of tool kinds to source kinds after edits.","Run config validation at process start.","Use distinct config files per database engine.","Add integration test that instantiates every tool with its declared source."],"tags":["go","config","source-binding","sqlite"],"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"}