{"record":{"id":"32bbc1484232afe0","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-32bbc1","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/serverlesssparklistsessions/serverlesssparklistsessions.go","lineNumber":132,"sourceCode":"\tres, err := source.ListSessions(ctx, pageSize, pt, filter)\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":114,"sourceCodeEnd":136,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/serverlessspark/serverlesssparklistsessions/serverlesssparklistsessions.go#L114-L136","documentation":"The serverlessspark-list-sessions tool throws this from ValidateSource when the source attached to the tool is not a Serverless Spark source implementing `compatibleSource`. The error surfaces during configuration loading/initialization because Toolbox validates each tool against its source before serving, ensuring the tool can construct the Dataproc session client it needs.","triggerScenarios":"Configuring `serverless-spark-list-sessions` with a `source` that resolves to a different source implementation, causing `source.(compatibleSource)` to fail in serverlesssparklistsessions.go.","commonSituations":"Wrong source name after copying a tool definition from another integration's docs; sources section reorganized and the Spark source key changed; YAML anchors/merging binding one source to many mismatched tools.","solutions":["Point `source:` at a `kind: serverless-spark` source.","Correct the source name typo or restore the missing serverless-spark source entry.","Regenerate/validate the tools.yaml with the Toolbox dev UI to confirm every tool/source pairing passes ValidateSource."],"exampleFix":"# before\ntools:\n  list-sessions:\n    kind: serverless-spark-list-sessions\n    source: dataproc-src\n# after\ntools:\n  list-sessions:\n    kind: serverless-spark-list-sessions\n    source: serverless-spark-src","handlingStrategy":"validation","validationCode":"tools:\n  list-sessions:\n    kind: serverless-spark-list-sessions\n    source: spark-src  # kind: serverless-spark required","typeGuard":"func isServerlessSparkSource(s sources.Source) bool {\n    _, ok := s.(serverlessspark.Source)\n    return ok\n}","tryCatchPattern":null,"preventionTips":["Verify tool/source pairings after any YAML restructure or merge.","Use the toolbox dev UI to load configs interactively and see validation errors immediately.","Keep integration-specific tools in separate config files to reduce cross-binding mistakes."],"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"}