{"record":{"id":"2fc0cc2f4b86c5df","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-2fc0cc","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/serverlesssparkgetsession/serverlesssparkgetsession.go","lineNumber":128,"sourceCode":"\tres, err := source.GetSession(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/serverlesssparkgetsession/serverlesssparkgetsession.go#L110-L132","documentation":"The serverlessspark-get-session tool throws this in its ValidateSource method when the bound source does not satisfy the tool's `compatibleSource` interface (a Serverless Spark source able to create session clients). The library validates tool/source compatibility at startup so misconfiguration is caught before any request. A type assertion failure means the named source exists but is of a different kind than the tool requires.","triggerScenarios":"A `serverless-spark-get-session` tool whose `source` field names a source whose concrete Go type is not the Serverless Spark source, so `source.(compatibleSource)` returns ok=false.","commonSituations":"tools.yaml with multiple sources where the tool references the wrong one; a refactored config where the Spark source was renamed/deleted and the name now resolves to another source; hand-edited YAML merging two example configs.","solutions":["Point the tool's `source` at a `kind: serverless-spark` source in tools.yaml.","Verify source name spelling and that the source block still exists with the serverless-spark kind.","Remove or replace the tool if it no longer matches your intended source type."],"exampleFix":"# before\ntools:\n  get-session:\n    kind: serverless-spark-get-session\n    source: mysql-src\n# after\ntools:\n  get-session:\n    kind: serverless-spark-get-session\n    source: spark-src  # kind: serverless-spark","handlingStrategy":"validation","validationCode":"tools:\n  get-session:\n    kind: serverless-spark-get-session\n    source: spark-src  # source must be kind: serverless-spark","typeGuard":"func isServerlessSparkSource(s sources.Source) bool {\n    _, ok := s.(serverlessspark.Source)\n    return ok\n}","tryCatchPattern":null,"preventionTips":["Validate the tools file at CI time by launching the toolbox binary against it.","Use distinct, descriptive source names to avoid binding tools to the wrong source.","Keep tool definitions close to their source definitions in the YAML for reviewability."],"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"}