{"record":{"id":"10bf1cd9dac15a09","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-10bf1c","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/tidb/tidbsql/tidbsql.go","lineNumber":130,"sourceCode":"\tres, err := source.RunSQL(ctx, newStatement, sliceParams)\n\tif err != nil {\n\t\treturn nil, util.ProcessGeneralError(err)\n\t}\n\treturn res, nil\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","sourceCodeStart":112,"sourceCodeEnd":134,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/tidb/tidbsql/tidbsql.go#L112-L134","documentation":"tidb-sql's ValidateSource requires the bound source to implement compatibleSource (TiDB-compatible). Any other source type fails the interface assertion, producing this error and blocking invocation with a mismatched engine.","triggerScenarios":"`tidb-sql` tool bound to a non-TiDB source via `source:`; direct Go call passing an incompatible source.","commonSituations":"Multi-database configs where tool/source names were swapped; refactors that renamed sources without updating tool bindings.","solutions":["Set `source:` to a TiDB-kind source name.","Add the missing TiDB source declaration.","Run a config lint that checks tool kind vs source kind pairs."],"exampleFix":"# before\nsource: spanner-prod\n# after\nsource: tidb-prod","handlingStrategy":"type-guard","validationCode":"# check each tidb-sql tool's source kind is TiDB\nyq '.tools[] | select(.kind == \"tidb-sql\") | .source' tools.yaml","typeGuard":"func isTiDBSource(s sources.Source) bool {\n    _, ok := s.(tidbsql.CompatibleSource)\n    return ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    log.Fatalf(\"bad source binding for tidb-sql: %v\", err)\n}","preventionTips":["Pair tool definitions with their sources in per-engine config files.","Run startup validation before serving traffic.","Keep source names unique across engines to avoid wrong bindings."],"tags":["go","config","source-binding","tidb"],"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"}