{"record":{"id":"58198bdf52e2a1f1","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-58198b","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":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/bigquery/bigqueryconversationalanalytics/bigqueryconversationalanalytics.go","lineNumber":161,"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\tvar tokenSource oauth2.TokenSource\n\tvar err error\n\t// Get credentials for the API call\n\tif source.UseClientAuthorization() {\n\t\t// Use client-side access token\n\t\tif accessToken == \"\" {\n\t\t\treturn nil, util.NewClientServerError(\"tool is configured for client OAuth but no token was provided in the request header\", http.StatusUnauthorized, nil)\n\t\t}\n\t\ttokenStr, err := accessToken.ParseBearerToken()","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/bigquery/bigqueryconversationalanalytics/bigqueryconversationalanalytics.go#L143-L179","documentation":"Tool.ValidateSource checks that the source bound to the conversational analytics tool implements the compatibleSource interface (a BigQuery-family source). If the configured source is of a different kind, the tool cannot obtain the client it needs, so it rejects the binding at initialization/validation time.","triggerScenarios":"A bigquery-conversational-analytics tool's config references a source whose type is not a compatible BigQuery source (e.g. a postgres or cloud-sql source), producing this error when ValidateSource runs.","commonSituations":"Copy-pasting a tool definition and leaving another source's name in the source field; mixing sources and tools of different engines in one YAML; renaming sources and pointing the tool at the wrong one.","solutions":["Point the tool's source field at a BigQuery-compatible source (e.g. a bigquery source kind)","Verify source kind and tool kind match in the YAML config","If wrapping a managed source, use a source type that implements the BigQuery client interface"],"exampleFix":"// before\ntools:\n  ask-data:\n    kind: bigquery-conversational-analytics\n    source: my-postgres-source\n// after\ntools:\n  ask-data:\n    kind: bigquery-conversational-analytics\n    source: my-bigquery-source","handlingStrategy":"type-guard","validationCode":"// check the source kind matches before binding\ndesiredSource := \"my-bigquery-source\"\nsrc := sources[desiredSource]\nif src == nil || src.SourceType() != \"bigquery\" {\n    return fmt.Errorf(\"source %q is not a BigQuery-compatible source\", desiredSource)\n}","typeGuard":"func asCompatibleBigQuerySource(s sources.Source) (compatibleSource, bool) {\n    c, ok := s.(compatibleSource)\n    return c, ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    return fmt.Errorf(\"source binding failed: %w (use a BigQuery source kind)\", err)\n}","preventionTips":["Match tool kind to source kind when writing YAML configs","Verify source names after renaming/refactoring configs","Use prebuilt configs for the engine you actually target"],"tags":["bigquery","configuration","source-compatibility","type-mismatch"],"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"}