{"record":{"id":"48bce4b0f9dba0ac","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-48bce4","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/alloydb/alloydbcreateuser/alloydbcreateuser.go","lineNumber":101,"sourceCode":"}\n\n// Tool represents the create-user tool.\ntype Tool struct {\n\ttools.BaseTool[Config]\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\n// Invoke executes the tool's logic.\nfunc (t Tool) Invoke(ctx context.Context, s sources.Source, params parameters.ParamValues, accessToken tools.AccessToken) (any, util.ToolboxError) {\n\tsource, ok := s.(compatibleSource)\n\tif !ok {\n\t\treturn nil, util.NewClientServerError(\"source used is not compatible with the tool\", http.StatusInternalServerError, nil)\n\t}\n\tparamsMap := params.AsMap()\n\tproject, ok := paramsMap[\"project\"].(string)\n\tif !ok || project == \"\" {\n\t\treturn nil, util.NewAgentError(\"invalid or missing 'project' parameter; expected a non-empty string\", nil)\n\t}\n\n\tlocation, ok := paramsMap[\"location\"].(string)\n\tif !ok || location == \"\" {","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/alloydb/alloydbcreateuser/alloydbcreateuser.go#L83-L119","documentation":"ValidateSource for alloydb-alloydbcreateuser asserts the bound source implements compatibleSource (an AlloyDB admin source exposing UseClientAuthorization and GetDefaultProject). A source of any other type fails the assertion and produces this error, blocking the user-creation tool from running against an unsupported source.","triggerScenarios":"alloydb-alloydbcreateuser configured with a `source` that is not the AlloyDB admin source; triggered during startup validation or right before Invoke.","commonSituations":"Pointing the tool at an alloydb-postgres or postgres source; template reuse where `source:` wasn't updated; a typo landing on the wrong source entry.","solutions":["Set `source` to a kind: alloydb admin source","Verify the referenced source's kind in the YAML `sources:` block","Restart and confirm clean tool registration in the logs"],"exampleFix":"// before\nsource: postgres-prod\n// after\nsource: alloydb-admin-prod","handlingStrategy":"validation","validationCode":"if err := tool.ValidateSource(src); err != nil {\n  log.Fatal(err)\n}","typeGuard":"func isAdminSource(s sources.Source) bool {\n  _, ok := s.(compatibleSource)\n  return ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n  return fmt.Errorf(\"bad source for create-user: %w\", err)\n}","preventionTips":["Pair each admin tool with an admin source explicitly","Verify source kinds in the sources: block"],"tags":["alloydb","tool-config","source-mismatch"],"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"}