{"record":{"id":"27189d8041302166","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-27189d","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/lookerdevmode/lookerdevmode.go","lineNumber":103,"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\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}\n\tmapParams := params.AsMap()\n\tdevMode, ok := mapParams[\"devMode\"].(bool)\n\tif !ok {\n\t\treturn nil, util.NewAgentError(fmt.Sprintf(\"'devMode' must be a boolean, got %T\", mapParams[\"devMode\"]), nil)\n\t}","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/looker/lookerdevmode/lookerdevmode.go#L85-L121","documentation":"ValidateSource asserts that the tool's source implements the looker-compatibleSource interface; any source of a kind other than \"looker\" fails the assertion and produces this error. It is a startup guard ensuring the tool only runs against a real Looker backend.","triggerScenarios":"Config load where the lookerdevmode tool references a non-looker source; direct calls to ValidateSource with a foreign sources.Source.","commonSituations":"Wrong source name in YAML; environments where a looker source was replaced by another kind; test code passing dummy sources.","solutions":["Bind the tool to a source with kind \"looker\"","Verify the referenced source exists and is looker-typed","Use a compatibleSource mock when unit testing"],"exampleFix":"// before\nsource: my-postgres\n// after\nsource: my-looker","handlingStrategy":"type-guard","validationCode":"if err := tool.ValidateSource(src); err != nil { return err }","typeGuard":"func isLookerSource(s sources.Source) bool { _, ok := s.(compatibleSource); return ok }","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil { log.Fatalf(\"tool %s bound to wrong source: %v\", name, err) }","preventionTips":["Run ValidateSource during config load for all looker tools","Keep one looker source per looker tool set","Review YAML after renaming/re-typing sources"],"tags":["go","looker","config","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"}