{"record":{"id":"47e3019fba977ab3","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-47e301","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/looker/lookeradddashboardelement/lookeradddashboardelement.go","lineNumber":132,"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\nvar (\n\tdataType string = \"data\"\n\tvisType  string = \"vis\"\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\tlogger, err := util.LoggerFromContext(ctx)\n\tif err != nil {\n\t\treturn nil, util.NewClientServerError(\"unable to get logger from ctx\", http.StatusInternalServerError, err)\n\t}","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/looker/lookeradddashboardelement/lookeradddashboardelement.go#L114-L150","documentation":"ValidateSource checks at config-load time that the tool's declared source implements the compatibleSource interface (the Looker source). This error means the source named by the tool either is not a Looker source or does not exist as a compatible type, so the tool cannot operate against it.","triggerScenarios":"A tools.yaml looker-add-dashboard-element tool references source: my-postgres (or any non-Looker source), or references a source name that maps to an incompatible source kind; ValidateSource is called during config validation.","commonSituations":"Copy-pasting a tool block from a looker toolset into a config whose sources are databases; renaming the source in sources: but not updating the tool's source field; YAML typo so the tool points at the wrong source entry.","solutions":["Point the tool's source field at a source defined with kind: looker","Add a looker source to the config and reference it from this tool","Fix the source name typo so it matches an existing Looker source entry"],"exampleFix":"// before\ntools:\n  add_tile:\n    kind: looker-add-dashboard-element\n    source: my_pg\n// after\ntools:\n  add_tile:\n    kind: looker-add-dashboard-element\n    source: my_looker","handlingStrategy":"validation","validationCode":"if _, ok := source.(lookercommon.LookerAPI); !ok {\n    return errors.New(\"tool requires a looker source\")\n}","typeGuard":"func isLookerSource(s sources.Source) bool {\n    _, ok := s.(compatibleSource)\n    return ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    // bind the tool to a kind: looker source and reload config\n    return err\n}","preventionTips":["Verify the tool's source field names a source with kind: looker","Run config validation at startup so ValidateSource catches mismatches early","Keep source names consistent; rename in one place when refactoring"],"tags":["looker","configuration","source-validation","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"}