{"record":{"id":"906de39d98240361","repo":"googleapis/mcp-toolbox","slug":"unable-to-parse-source-q-as-q-w","errorCode":null,"errorMessage":"unable to parse source %q as %q: %w","messagePattern":"unable to parse source %q as %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/sources.go","lineNumber":54,"sourceCode":"// It returns false if the type is already registered.\nfunc Register(sourceType string, factory SourceConfigFactory) bool {\n\tif _, exists := sourceRegistry[sourceType]; exists {\n\t\t// Source with this type already exists, do not overwrite.\n\t\treturn false\n\t}\n\tsourceRegistry[sourceType] = factory\n\treturn true\n}\n\n// DecodeConfig decodes a source configuration using the registered factory for the given type.\nfunc DecodeConfig(ctx context.Context, sourceType string, name string, decoder *yaml.Decoder) (SourceConfig, error) {\n\tfactory, found := sourceRegistry[sourceType]\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"unknown source type: %q\", sourceType)\n\t}\n\tsourceConfig, err := factory(ctx, name, decoder)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to parse source %q as %q: %w\", name, sourceType, err)\n\t}\n\treturn sourceConfig, err\n}\n\n// SourceConfig is the interface for configuring a source.\ntype SourceConfig interface {\n\tSourceConfigType() string\n\tInitialize(ctx context.Context, tracer trace.Tracer) (Source, error)\n}\n\n// Source is the interface for the source itself.\ntype Source interface {\n\tSourceType() string\n\tToConfig() SourceConfig\n\tIsReadOnly() bool\n}\n\n// InitConnectionSpan adds a span for database pool connection initialization","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/sources.go#L36-L72","documentation":"A factory was found for the source type, but the subsequent YAML decode into the source-specific Config failed — one or more fields under the source's `spec` do not match that source's schema.","triggerScenarios":"Thrown at internal/sources/sources.go:54 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Compare the source's spec fields with the documentation for that source type","Fix field names, types, or missing required fields","Check indentation and nesting of the spec block"],"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-08T10:18:20.063Z"}