{"record":{"id":"092bba4d7426859d","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-092bba","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/postgreslistquerystats/postgreslistquerystats.go","lineNumber":140,"sourceCode":"\tresp, err := source.RunSQL(ctx, listQueryStats, 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":122,"sourceCodeEnd":144,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/postgres/postgreslistquerystats/postgreslistquerystats.go#L122-L144","documentation":"The postgres-list-query-stats tool's ValidateSource rejects the configured source because it lacks the compatibleSource methods (PostgresPool() *pgxpool.Pool, RunSQL). Query stats read pg_stat_statements-style data, which only Postgres-family sources can provide. The check happens when the tool is initialized and bound to the source.","triggerScenarios":"A `postgres-list-query-stats` tool whose `source:` names a source of an incompatible kind (mysql, mssql, sqlite, http, etc.) or a nonexistent source key.","commonSituations":"Copy-pasting tool defs between database configs; referencing cloud-sql-mysql sources from postgres tools; typos in the source name.","solutions":["Set `source:` to a Postgres-family source (postgres, cloud-sql-postgres, alloydb-postgres).","Ensure the source is defined in `sources:` with a Postgres `kind`.","Use the correct engine-specific tool if you are not on Postgres."],"exampleFix":"# before\ntools:\n  query-stats:\n    kind: postgres-list-query-stats\n    source: my-sqlite\n# after\ntools:\n  query-stats:\n    kind: postgres-list-query-stats\n    source: my-postgres","handlingStrategy":"validation","validationCode":"src := myConfig.sources[tool.Source]\nif _, ok := src.(interface {\n    PostgresPool() *pgxpool.Pool\n    RunSQL(context.Context, string, []any) (any, error)\n}); !ok {\n    return fmt.Errorf(\"postgres-list-query-stats requires a Postgres-family source, got %T\", src)\n}","typeGuard":"func isCompatiblePostgresSource(s sources.Source) bool {\n    _, ok := s.(interface {\n        PostgresPool() *pgxpool.Pool\n        RunSQL(context.Context, string, []any) (any, error)\n    })\n    return ok\n}","tryCatchPattern":null,"preventionTips":["Attach query-stats tools only to Postgres-family sources (pg_stat_statements is Postgres-only).","Verify source names exist in `sources:` after refactors.","Run a config validation/smoke test in CI."],"tags":["postgres","source-validation","config","go"],"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"}