{"record":{"id":"9d5efee4a2826413","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-9d5efe","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":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/postgres/postgreslisttablestats/postgreslisttablestats.go","lineNumber":179,"sourceCode":"\tresp, err := source.RunSQL(ctx, listTableStats, sliceParams)\n\tif err != nil {\n\t\treturn nil, util.ProcessGeneralError(err)\n\t}\n\treturn resp, 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":161,"sourceCodeEnd":183,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/postgres/postgreslisttablestats/postgreslisttablestats.go#L161-L183","documentation":"This error is thrown by the postgres-list-tablestats tool's ValidateSource method when the source named in the tool's YAML config does not implement the tool's `compatibleSource` interface (a Postgres-backed source exposing a pgx pool). MCP Toolbox tools are decoupled from concrete source types, so at startup each tool type-asserts its configured source; the assertion failing means the tool was wired to a source it cannot use.","triggerScenarios":"Server startup/config validation when a tool of `kind: postgres-list-tablestats` references a `source:` whose registered source does not satisfy the compatibleSource interface (e.g. a non-Postgres source like redis, mysql, http).","commonSituations":"Copy-pasted tool entries with stale `source:` names; pointing Postgres tools at MySQL/Cloud SQL MySQL sources; typos that resolve to a differently-typed source.","solutions":["Change the tool's `source:` field to the name of a Postgres source defined in `sources:`","Verify the source kind (e.g. `postgres`) implements the interface the tool requires","Validate the config locally before deploying"],"exampleFix":"# before\nkind: postgres-list-tablestats\nsource: my-mysql-source\n# after\nkind: postgres-list-tablestats\nsource: my-postgres-source","handlingStrategy":"validation","validationCode":"if _, ok := any(myPostgresSource).(interface {\n\tPostgresPool() *pgxpool.Pool\n\tRunSQL(context.Context, string, []any) (any, error)\n}); !ok {\n\tlog.Fatalf(\"source is not compatible with postgres-list-tablestats\")\n}","typeGuard":"func isCompatiblePostgresSource(s sources.Source) bool {\n\t_, ok := s.(interface {\n\t\tPostgresPool() *pgxpool.Pool\n\t\tRunSQL(context.Context, string, []any) (any, error)\n\t})\n\treturn ok\n}","tryCatchPattern":null,"preventionTips":["Match tool kind prefix to source kind (postgres-* -> kind: postgres)","Validate tools.yaml in CI with the toolbox binary","Grep tools.yaml for `source:` values after renaming sources","Keep one canonical source per engine to reduce mismatches"],"tags":["go","config","postgres","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"}