{"record":{"id":"cd3bbc9340bb61c6","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-cd3bbc","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/elasticsearch/elasticsearchexecuteesql/elasticsearchexecuteesql.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\tquery, ok := paramsMap[\"query\"].(string)\n\tif !ok {\n\t\treturn nil, util.NewAgentError(fmt.Sprintf(\"unable to get cast %s\", paramsMap[\"query\"]), nil)\n\t}\n\n\t// Default to json format\n\tformat := t.Cfg.Format\n\tif format == \"\" {","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/elasticsearch/elasticsearchexecuteesql/elasticsearchexecuteesql.go#L82-L118","documentation":"Same family as error 1390: ValidateSource in elasticsearchexecuteesql.go performs a type assertion of the bound source to the private `compatibleSource` interface; a source of any other type fails the assertion and the tool reports that the source is not a compatible type. The elasticsearch-execute-esql tool can only run against an Elasticsearch source.","triggerScenarios":"A tool of kind `elasticsearch-execute-esql` whose `source` references a source whose Go implementation does not implement compatibleSource (any non-Elasticsearch source kind).","commonSituations":"Mistyping the source name in tools.yaml so it resolves to a different source; refactoring a multi-source config and rebinding tools to the wrong source; using a managed-source wrapper that isn't recognized as Elasticsearch-compatible.","solutions":["Bind the tool to a source whose kind is `elasticsearch`","Grep tools.yaml for the source name used by this tool and confirm its `kind`","If wrapping CloudSQL/other managed Elasticsearch, ensure the correct source type is used","Restart the toolbox after fixing the config so validation re-runs"],"exampleFix":"// before (tools.yaml)\ntools:\n  q:\n    kind: elasticsearch-execute-esql\n    source: alloydb-src\n// after\ntools:\n  q:\n    kind: elasticsearch-execute-esql\n    source: elasticsearch-src","handlingStrategy":"validation","validationCode":"// Assert source kind matches the tool family before load:\n// tool kind `elasticsearch-execute-esql` requires sources.<name>.kind == \"elasticsearch\"\nif src.Kind != \"elasticsearch\" {\n    return fmt.Errorf(\"tool %s requires an elasticsearch source, got %s\", toolName, src.Kind)\n}","typeGuard":"if _, ok := src.(elasticsearchexecuteesql.CompatibleSource); !ok {\n    return fmt.Errorf(\"%T cannot back elasticsearch-execute-esql\", src)\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    return nil, fmt.Errorf(\"fix tools.yaml source binding for %s: %w\", toolName, err)\n}","preventionTips":["Name sources after their engine to make mismatches obvious in diffs","Run `toolbox` startup validation in CI pipelines","Review source references whenever renaming or removing sources","For managed Elasticsearch-compatible services, confirm the exact supported source kind in docs"],"tags":["go","configuration","source-binding","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"}