{"record":{"id":"8339ba868db454d1","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-8339ba","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/serverlessspark/serverlesssparkgetsessiontemplate/serverlesssparkgetsessiontemplate.go","lineNumber":128,"sourceCode":"\tres, err := source.GetSessionTemplate(ctx, name)\n\tif err != nil {\n\t\treturn nil, util.ProcessGcpError(err)\n\t}\n\treturn res, 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":110,"sourceCodeEnd":132,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/serverlessspark/serverlesssparkgetsessiontemplate/serverlesssparkgetsessiontemplate.go#L110-L132","documentation":"The serverlessspark-get-session-template tool throws this from ValidateSource when the configured source fails the `compatibleSource` type assertion, i.e. it is not a Serverless Spark source with the required session-template client method. Toolbox enforces this check when the tool is initialized against its configured source so incompatible pairings never reach Invoke.","triggerScenarios":"Declaring a `serverless-spark-get-session-template` tool whose `source` references a non-serverless-spark source (e.g. postgres, bigquery, http), making the interface assertion in ValidateSource fail.","commonSituations":"Reusing a single shared `source:` anchor across tools of different kinds; template scaffolding that left a placeholder source name; team members adding tools without a matching Spark source in the environment.","solutions":["Change the tool's `source` to the name of a `serverless-spark` kind source.","Add a `kind: serverless-spark` source to tools.yaml if none exists, then reference it.","Audit all serverless-spark-* tools' source fields when refactoring the sources section."],"exampleFix":"# before\ntools:\n  get-template:\n    kind: serverless-spark-get-session-template\n    source: bq-src\n# after\ntools:\n  get-template:\n    kind: serverless-spark-get-session-template\n    source: spark-src","handlingStrategy":"validation","validationCode":"sources:\n  spark-src:\n    kind: serverless-spark\ntools:\n  get-template:\n    kind: serverless-spark-get-session-template\n    source: spark-src","typeGuard":"func isServerlessSparkSource(s sources.Source) bool {\n    _, ok := s.(serverlessspark.Source)\n    return ok\n}","tryCatchPattern":null,"preventionTips":["Never share a single `source:` anchor across tools of different kinds.","Review the sources section whenever adding serverless-spark-* tools.","Start the server locally before deploying; Toolbox surfaces the exact tool and source name in this error."],"tags":["configuration","go","type-mismatch","serverless-spark"],"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"}