{"record":{"id":"2827f49256a6f890","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-2827f4","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/postgreslisttablespaces/postgreslisttablespaces.go","lineNumber":148,"sourceCode":"\tresp, err := source.RunSQL(ctx, listTableSpacesStatement, []any{tablespaceName, limit})\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":130,"sourceCodeEnd":152,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/postgres/postgreslisttablespaces/postgreslisttablespaces.go#L130-L152","documentation":"This error is thrown by the postgres-list-tablespaces 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-tablespaces` references a `source:` whose registered source does not satisfy the compatibleSource interface (e.g. a non-Postgres source like redis, mysql, http, or a Postgres variant lacking the required methods).","commonSituations":"Copy-pasting a tool entry and forgetting to update the `source:` field; pointing postgres tools at a cloud-sql or alloydb source variant that does not implement PostgresPool()/the required methods; renaming sources and leaving stale references in tools.yaml.","solutions":["Change the tool's `source:` field in tools.yaml to the name of a Postgres source defined in the `sources:` section","Verify the referenced source kind supports Postgres tools (its Go type implements PostgresPool()/RunSQL) — e.g. `kind: postgres`","Run `./toolbox --tools-file tools.yaml` or the config validate command locally to catch the mismatch before deployment"],"exampleFix":"# before\ntools:\n  list-ts:\n    kind: postgres-list-tablespaces\n    source: my-redis-source\n# after\ntools:\n  list-ts:\n    kind: postgres-list-tablespaces\n    source: my-postgres-source","handlingStrategy":"validation","validationCode":"// before starting the server, assert the source is compatible\nvar _ sources.Source = myPostgresSource\nif _, ok := any(myPostgresSource).(interface {\n\tPostgresPool() *pgxpool.Pool\n\tRunSQL(context.Context, string, []any) (any, error)\n}); !ok {\n\tlog.Fatalf(\"source %q is not compatible with postgres-list-tablespaces\", \"my-postgres-source\")\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":["Keep tool `source:` names pointing at sources whose kind matches the tool's engine prefix (postgres-* tools -> kind: postgres)","Lint tools.yaml so every postgres-* tool's source resolves to a postgres source","Run `toolbox --tools-file tools.yaml` in CI to fail fast on source/tool mismatches","Avoid copy-pasting tool blocks without updating `source:`"],"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"}