{"record":{"id":"3f3eb914f2b9bee8","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-3f3eb9","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/dataplex/dataplexlistdataproducts/dataplexlistdataproducts.go","lineNumber":114,"sourceCode":"// validate interface\nvar _ tools.Tool = Tool{}\n\ntype Tool struct {\n\ttools.BaseTool[Config]\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\nfunc (t Tool) Invoke(ctx context.Context, s sources.Source, params parameters.ParamValues, accessToken tools.AccessToken) (any, util.ToolboxError) {\n\tsource, ok := s.(compatibleSource)\n\tif !ok {\n\t\treturn nil, util.NewClientServerError(\"source used is not compatible with the tool\", http.StatusInternalServerError, nil)\n\t}\n\tparamsMap := params.AsMap()\n\tfilter, _ := paramsMap[\"filter\"].(string)\n\tpageSize, _ := paramsMap[\"pageSize\"].(int)\n\torderBy, _ := paramsMap[\"orderBy\"].(string)\n\n\tresp, err := source.ListDataProducts(ctx, filter, pageSize, orderBy)\n\tif err != nil {\n\t\treturn nil, util.ProcessGcpError(err)\n\t}","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/dataplex/dataplexlistdataproducts/dataplexlistdataproducts.go#L96-L132","documentation":"The dataplex-list-data-products tool only works with a Dataplex source that implements its compatibleSource interface (ListDataProducts method). ValidateSource type-asserts the injected source and returns this error when the attached source is a different kind (e.g. a Postgres source wired to a Dataplex tool). It is a configuration/wiring error, not a runtime data error.","triggerScenarios":"Calling ValidateSource (or tool invocation) on dataplex-list-data-products when the attached sources.Source does not implement compatibleSource (ListDataProducts(ctx, filter, pageSize, orderBy)).","commonSituations":"YAML config assigns a non-Dataplex source to this tool; copying a tool block from another integration without changing its source; renames/refactors that changed the Dataplex source type.","solutions":["Set the tool's source to a Dataplex source (sourceKind: dataplex) in the tools config","Verify the source entry under `sources:` is type dataplex and initializes successfully","Rebuild/restart toolbox and confirm tool startup validation passes"],"exampleFix":"// before\ntools:\n  list-data-products:\n    kind: dataplex-list-data-products\n    source: my-postgres-source\n// after\ntools:\n  list-data-products:\n    kind: dataplex-list-data-products\n    source: my-dataplex-source","handlingStrategy":"type-guard","validationCode":"// Go: before wiring the tool\nvar _ sources.Source = mySource\nif _, ok := mySource.(interface {\n\tListDataProducts(ctx context.Context, filter string, pageSize int, orderBy string) ([]*dataplex.DataProductSummary, error)\n}); !ok {\n\treturn fmt.Errorf(\"source %T is not compatible with dataplex-list-data-products\", mySource)\n}","typeGuard":"func isDataplexListDataProductsSource(s sources.Source) bool {\n\t_, ok := s.(interface {\n\t\tListDataProducts(ctx context.Context, filter string, pageSize int, orderBy string) ([]*dataplex.DataProductSummary, error)\n\t})\n\treturn ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n\t// handle invalid-source-type: fix tool->source binding in config\n\tlog.Printf(\"invalid source binding: %v\", err)\n\treturn err\n}","preventionTips":["Always set the tool's source to a dataplex source in YAML","Run toolbox startup so ValidateSource failures surface immediately","Add interface assertions in source tests for each tool binding"],"tags":["go","dataplex","type-mismatch","configuration"],"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"}