{"record":{"id":"677e721f0f526f4a","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-677e72","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/cassandra/cassandracql/cassandracql.go","lineNumber":106,"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\n// Invoke implements tools.Tool.\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\tnewStatement, err := parameters.ResolveTemplateParams(t.Cfg.TemplateParameters, t.Cfg.Statement, paramsMap)\n\tif err != nil {\n\t\treturn nil, util.NewAgentError(\"unable to extract template params\", err)\n\t}\n\n\tnewParams, err := parameters.GetParams(t.Cfg.Parameters, paramsMap)\n\tif err != nil {","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/cassandra/cassandracql/cassandracql.go#L88-L124","documentation":"Thrown by the cassandracql Tool.ValidateSource when the sources.Source passed in does not implement the tool's compatibleSource interface. This fails fast with a message identifying the tool and the offending source name before any CQL is executed.","triggerScenarios":"Invoke/ValidateSource is called with a source whose concrete type fails the type assertion to cassandracql's compatibleSource — typically the tool's source field in tools.yaml references a non-Cassandra source.","commonSituations":"Pointing a cassandra-cql tool at a Postgres/MySQL/other source; renaming sources and missing a reference; programmatically pairing tools with sources of the wrong kind.","solutions":["Set the tool's source field to a cassandra source in tools.yaml","Verify the referenced source name exists and is a Cassandra-compatible source","Restart the toolbox to reload the configuration","If invoking programmatically, pass the Cassandra source instance satisfying compatibleSource"],"exampleFix":"// before (tools.yaml)\nsources:\n  my-db:\n    kind: postgres\n    uri: ...\ntools:\n  cql-query:\n    kind: cassandra-cql\n    source: my-db\n// after\nsources:\n  my-cassandra:\n    kind: cassandra\n    hosts: [127.0.0.1]\ntools:\n  cql-query:\n    kind: cassandra-cql\n    source: my-cassandra","handlingStrategy":"type-guard","validationCode":"// Pre-check the source before running the cql tool\nif err := tool.ValidateSource(mySource); err != nil {\n    return fmt.Errorf(\"bad source-tool pairing for %s: %w\", toolName, err)\n}","typeGuard":"func isCompatibleCassandraSource(s sources.Source) (cassandracql.CompatibleSource, bool) {\n    cs, ok := s.(cassandracql.CompatibleSource)\n    return cs, ok\n}","tryCatchPattern":null,"preventionTips":["Point cassandra-cql tools only at cassandra sources","Validate config at startup; the toolbox fails fast on incompatible pairs","After renaming/deleting sources, update all tool references","Write the error message's source name down — it names the offending source"],"tags":["go","config","type-mismatch","cassandra"],"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"}