{"record":{"id":"7dc04302fbd185ee","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-7dc043","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/alloydbainl/alloydbainl.go","lineNumber":155,"sourceCode":"\tresp, err := source.RunSQL(ctx, t.Statement, allParamValues)\n\tif err != nil {\n\t\treturn nil, util.NewClientServerError(fmt.Sprintf(\"error running SQL query: %v. Query: %v , Values: %v. Toolbox v0.19.0+ is only compatible with AlloyDB AI NL v1.0.3+. Please ensure that you are using the latest AlloyDB AI NL extension\", err, t.Statement, allParamValues), http.StatusBadRequest, err)\n\t}\n\treturn resp, nil\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","sourceCodeStart":137,"sourceCodeEnd":159,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/alloydbainl/alloydbainl.go#L137-L159","documentation":"ValidateSource() for the alloydbainl tool asserts the source implements its compatibleSource interface (an AlloyDB Postgres-compatible source with NL-config support). Any other source type is rejected with this error identifying the tool type and configured source name.","triggerScenarios":"Binding an alloydbainl tool to a non-AlloyDB source (e.g. mysql, mssql, or a plain source lacking the required methods) and calling ValidateSource during server startup.","commonSituations":"Pointing the NL tool at a mysql or cloud-sql source instead of the alloydb source; renaming sources so the reference resolves to a different kind; prebuilt config edits.","solutions":["Set the tool's source to an AlloyDB source implementing compatibleSource.","Confirm the source kind under sources: matches alloydb (Postgres-compatible AlloyDB).","Use the NL tool variant intended for the other database engine if that's the actual target."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"if err := tool.ValidateSource(src); err != nil {\n    return fmt.Errorf(\"alloydbainl bound to wrong source: %w\", err)\n}","typeGuard":"cs, ok := src.(alloydbainl.CompatibleSource)\nif !ok {\n    return fmt.Errorf(\"source %T is not AlloyDB-compatible for NL tool\", src)\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    log.Fatalf(\"invalid source binding: %v\", err)\n}","preventionTips":["Bind NL tools only to alloydb sources.","Call ValidateSource during startup wiring, not lazily at request time.","Keep source names unique and descriptive to avoid mis-binding."],"tags":["configuration","type-mismatch","alloydb","source-validation"],"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"}