{"record":{"id":"38d8c8eb9dd7805c","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-38d8c8","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/dataplexgetrunstatus/dataplexgetrunstatus.go","lineNumber":100,"sourceCode":"\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\tscanId, _ := paramsMap[\"scanId\"].(string)\n\tlocation, _ := paramsMap[\"location\"].(string)\n\tjobId, _ := paramsMap[\"jobId\"].(string)\n\n\tif scanId == \"\" {\n\t\treturn nil, util.NewAgentError(\"scanId parameter is required\", nil)\n\t}\n\tif location == \"\" {","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/dataplex/dataplexgetrunstatus/dataplexgetrunstatus.go#L82-L118","documentation":"The dataplexgetrunstatus tool's ValidateSource produces this error when the source's concrete type does not satisfy the tool's `compatibleSource` interface (GetRunStatus method). This fail-fast check rejects sources that cannot look up Dataplex data-scan run status before Invoke is attempted. It indicates a tool-to-source type mismatch in wiring or code.","triggerScenarios":"Calling ValidateSource with a source lacking GetRunStatus(ctx, dataScanId, jobRunId) with the exact signature — typically from wrong source wiring in tools.yaml or an incomplete test fake.","commonSituations":"Misconfigured tools.yaml referencing a non-Dataplex source; legacy or custom source implementations missing GetRunStatus; refactors renaming parameters so the source no longer satisfies the interface; version skew between tool and source packages.","solutions":["Configure the tool with a Dataplex source implementing GetRunStatus.","Compare method sets against compatibleSource in internal/tools/dataplex/dataplexgetrunstatus/dataplexgetrunstatus.go.","Add or fix GetRunStatus on custom sources to match the interface exactly.","Update tests so fakes implement the tool's compatibleSource interface."],"exampleFix":"// before\n// tools:\n//   run-status:\n//     kind: dataplex-get-run-status\n//     source: bigquery-source   # not compatible\n//\n// after\n// tools:\n//   run-status:\n//     kind: dataplex-get-run-status\n//     source: dataplex-source   # satisfies compatibleSource","handlingStrategy":"validation","validationCode":"func checkRunStatusSupport(s sources.Source) error {\n\tif _, ok := s.(interface {\n\t\tGetRunStatus(ctx context.Context, dataScanId, jobRunId string) (*dataplex.Run, error)\n\t}); !ok {\n\t\treturn errors.New(\"source lacks GetRunStatus; required by dataplex-get-run-status\")\n\t}\n\treturn nil\n}","typeGuard":"func isGetRunStatusSource(s sources.Source) bool {\n\t_, ok := s.(dataplexgetrunstatus.CompatibleSource)\n\treturn ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n\treturn nil, fmt.Errorf(\"configuration error (no retry will help): %w\", err)\n}","preventionTips":["Pair dataplex-get-run-status only with dataplex sources in tools.yaml.","Validate tool/source bindings when the server starts.","Add unit tests exercising ValidateSource with wrong-type sources.","Synchronize interface changes across tool and source packages in one PR."],"tags":["go","type-assertion","dataplex","source-compatibility","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"}