{"record":{"id":"e0f771f77bf5c9fd","repo":"googleapis/mcp-toolbox","slug":"tool-type-q-already-registered-e0f771","errorCode":null,"errorMessage":"tool type %q already registered","messagePattern":"tool type %q already registered","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/cloudsqlpg/vectorassistmodifyspec/vectorassistmodifyspec.go","lineNumber":47,"sourceCode":")\n\nconst resourceType string = \"vector-assist-modify-spec\"\n\nconst modifySpecQuery = `\n    SELECT recommendation_id, vector_spec_id, table_name, schema_name, query, recommendation, applied, modified, created_at\n    FROM vector_assist.modify_spec(spec_id => @spec_id::TEXT, table_name => @table_name::TEXT, schema_name => @schema_name::TEXT,\n        vector_column_name => @vector_column_name::TEXT, text_column_name => @text_column_name::TEXT,\n        vector_index_type => @vector_index_type::TEXT, embeddings_available => @embeddings_available::BOOLEAN,\n        num_vectors => @num_vectors::INTEGER, dimensionality => @dimensionality::INTEGER,\n        embedding_model => @embedding_model::TEXT, prefilter_column_names => @prefilter_column_names,\n        distance_func => @distance_func::TEXT, quantization => @quantization::TEXT,\n        memory_budget_kb => @memory_budget_kb::INTEGER, target_recall => @target_recall::FLOAT,\n        target_top_k => @target_top_k::INTEGER, tune_vector_index => @tune_vector_index::BOOLEAN);\n`\n\nfunc init() {\n\tif !tools.Register(resourceType, newConfig) {\n\t\tpanic(fmt.Sprintf(\"tool type %q already registered\", resourceType))\n\t}\n}\n\nfunc newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.ToolConfig, error) {\n\tactual := Config{ConfigBase: tools.ConfigBase{Name: name}}\n\tif err := decoder.DecodeContext(ctx, &actual); err != nil {\n\t\treturn nil, err\n\t}\n\treturn actual, nil\n}\n\ntype compatibleSource interface {\n\tPostgresPool() *pgxpool.Pool\n\tRunSQL(context.Context, string, []any) (any, error)\n}\n\ntype Config struct {\n\ttools.ConfigBase `yaml:\",inline\"`","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/cloudsqlpg/vectorassistmodifyspec/vectorassistmodifyspec.go#L29-L65","documentation":"The package's init() registers the 'vector-assist-modify-spec' tool type in the global registry and panics if tools.Register returns false, meaning the type string was already claimed. This is a duplicate-registration guard for programming errors (e.g. a vendored or duplicated package copy linked into the binary), not a user config issue.","triggerScenarios":"Thrown at internal/tools/cloudsqlpg/vectorassistmodifyspec/vectorassistmodifyspec.go:47 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the package is not imported twice under different paths (e.g. vendored and module copies)","Rename the conflicting resourceType constant if two distinct tools share it","Clean go.mod/go.sum and rebuild to eliminate stale duplicate dependencies"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}