{"record":{"id":"f0e2372d56b14517","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-f0e237","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/serverlessspark/serverlesssparkcancelbatch/serverlesssparkcancelbatch.go","lineNumber":129,"sourceCode":"\tresp, err := source.CancelOperation(ctx, operation)\n\tif err != nil {\n\t\treturn nil, util.ProcessGcpError(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":111,"sourceCodeEnd":133,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/serverlessspark/serverlesssparkcancelbatch/serverlesssparkcancelbatch.go#L111-L133","documentation":"Identical type-compatibility guard as the other Serverless Spark tools: serverlesssparkcancelbatch.ValidateSource requires the bound source to implement its compatibleSource interface (CancelBatch capability). A mismatched source kind fails config initialization with this error, which names the tool type and source name for diagnosis.","triggerScenarios":"A cancel-batch tool config references a source not implementing the Serverless Spark compatibleSource interface — e.g. wired to a Postgres/BigQuery source — during toolbox startup validation.","commonSituations":"Template-based config edits where the tool's source key still points at a database source; multi-source YAML files where two sources share a similar name and the wrong one is referenced.","solutions":["Verify the cancel-batch tool's 'source:' points to a serverlessspark source in the YAML","Update the source reference to the correct Serverless Spark source","Restart and confirm the tool initializes"],"exampleFix":"# before\ntools:\n  cancel-batch:\n    source: alloydb-src\n# after\ntools:\n  cancel-batch:\n    source: spark-src","handlingStrategy":"type-guard","validationCode":"if _, ok := src.(cancelbatch.CompatibleSource); !ok {\n    return fmt.Errorf(\"source %T cannot back cancel-batch tool\", src)\n}\nerr := tool.ValidateSource(src)","typeGuard":"func isCancelBatchSource(s sources.Source) bool {\n    _, ok := s.(serverlesssparkcancelbatch.CompatibleSource)\n    return ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    log.Fatalf(\"cancel-batch tool requires a serverlessspark source: %v\", err)\n}","preventionTips":["Ensure all serverlessspark-* tools share the same serverlessspark source entry","Diff tool source references after config refactors","Boot the toolbox in a staging env to surface validation errors pre-prod"],"tags":["config","type-mismatch","serverlessspark","source-binding"],"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"}