{"record":{"id":"f0dbf101b67fb957","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-f0dbf1","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/postgreslistpgsettings/postgreslistpgsettings.go","lineNumber":137,"sourceCode":"\tresp, err := source.RunSQL(ctx, listPgSettingsStatement, 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":119,"sourceCodeEnd":141,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/postgres/postgreslistpgsettings/postgreslistpgsettings.go#L119-L141","documentation":"The postgres-list-pg-settings tool's ValidateSource rejects the configured source because it does not implement compatibleSource (PostgresPool() *pgxpool.Pool plus RunSQL). Toolbox checks tool/source compatibility at startup so failures surface early instead of at invocation time. The configured `source:` names a source kind that cannot serve Postgres pg_settings queries.","triggerScenarios":"A `postgres-list-pg-settings` tool entry in the yaml whose `source:` points to a non-Postgres source (mysql, mssql, sqlite, http, etc.) or to an unregistered/typo'd source name.","commonSituations":"Hand-editing prebuilt configs across database engines; renaming a source but not updating the tool's `source:`; mixing cloud-sql-mysql sources with postgres tools.","solutions":["Set the tool's `source:` to a Postgres-family source (postgres, cloud-sql-postgres, alloydb-postgres).","Verify the source exists under `sources:` and its `kind` implements the Postgres pool interface.","Use the tool variant matching your actual source kind if you are not on Postgres."],"exampleFix":"# before\ntools:\n  pg-settings:\n    kind: postgres-list-pg-settings\n    source: mysql-db\n# after\ntools:\n  pg-settings:\n    kind: postgres-list-pg-settings\n    source: postgres-db","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-pg-settings 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":["Map pg-settings-style tools only to postgres/cloud-sql-postgres/alloydb-postgres sources.","Run the toolbox server once in CI to catch ValidateSource errors before release.","Double-check source names for typos after any rename."],"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"}