{"record":{"id":"54a7e36a03f81235","repo":"googleapis/mcp-toolbox","slug":"invalid-alloweddataset-format-q-expected-proje","errorCode":null,"errorMessage":"invalid allowedDataset format: %q, expected 'project.dataset' or 'dataset'","messagePattern":"invalid allowedDataset format: %q, expected 'project\\.dataset' or 'dataset'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/bigquery/bigquery.go","lineNumber":228,"sourceCode":"\t\t\ts.AuthTokenHeaderName = r.UseClientOAuth\n\t\t}\n\t\t// use client OAuth\n\t\tbaseClientCreator, err := newBigQueryClientCreator(ctx, tracer, r.Project, r.Location, r.QuotaProject, r.Name, endpoint)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error constructing client creator: %w\", err)\n\t\t}\n\t\tsetupClientCaching(s, baseClientCreator)\n\t}\n\n\tallowedDatasets := make(map[string]struct{})\n\t// Get full id of allowed datasets and verify they exist.\n\tif len(r.AllowedDatasets) > 0 {\n\t\tfor _, allowed := range r.AllowedDatasets {\n\t\t\tvar projectID, datasetID, allowedFullID string\n\t\t\tif strings.Contains(allowed, \".\") {\n\t\t\t\tparts := strings.Split(allowed, \".\")\n\t\t\t\tif len(parts) != 2 {\n\t\t\t\t\treturn nil, fmt.Errorf(\"invalid allowedDataset format: %q, expected 'project.dataset' or 'dataset'\", allowed)\n\t\t\t\t}\n\t\t\t\tprojectID = parts[0]\n\t\t\t\tdatasetID = parts[1]\n\t\t\t\tallowedFullID = allowed\n\t\t\t} else {\n\t\t\t\tprojectID = r.Project\n\t\t\t\tdatasetID = allowed\n\t\t\t\tallowedFullID = fmt.Sprintf(\"%s.%s\", projectID, datasetID)\n\t\t\t}\n\n\t\t\tif s.Client != nil {\n\t\t\t\tdataset := s.Client.DatasetInProject(projectID, datasetID)\n\t\t\t\t_, err := dataset.Metadata(ctx)\n\t\t\t\tif err != nil {\n\t\t\t\t\ts.Client.Close()\n\t\t\t\t\tif gerr, ok := err.(*googleapi.Error); ok && gerr.Code == http.StatusNotFound {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"allowedDataset '%s' not found in project '%s'\", datasetID, projectID)\n\t\t\t\t\t}","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/bigquery/bigquery.go#L210-L246","documentation":"Each entry in allowedDatasets must be either a bare 'dataset' name or a fully qualified 'project.dataset' (exactly one dot, two parts). Initialize parses each entry; any other format — multiple dots, empty segments, or unexpected characters — fails with this error.","triggerScenarios":"allowedDatasets containing an entry like 'proj.ds.with.dots', 'project.', '.dataset', or an empty string with a dot producing wrong part counts.","commonSituations":"Copy-pasting fully qualified table IDs (project.dataset.table) instead of dataset IDs; trailing dots from sloppy editing; assuming nested or comma-separated formats are supported.","solutions":["Use exactly 'project.dataset' (one dot) or just 'dataset' for the source's own project.","Convert table-level IDs by dropping the table part (project.dataset.table -> project.dataset).","Remove empty or malformed entries from the allowedDatasets list."],"exampleFix":"// before\nallowedDatasets:\n  - myproject.mydataset.mytable\n// after\nallowedDatasets:\n  - myproject.mydataset","handlingStrategy":"validation","validationCode":"func validateAllowedDatasets(entries []string) error {\n\tfor _, e := range entries {\n\t\tif e == \"\" { return fmt.Errorf(\"empty allowedDataset entry\") }\n\t\tparts := strings.Split(e, \".\")\n\t\tif len(parts) > 2 || parts[0] == \"\" || (len(parts) == 2 && parts[1] == \"\") {\n\t\t\treturn fmt.Errorf(\"invalid allowedDataset %q: use 'project.dataset' or 'dataset'\", e)\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":"src, err := sourceRegistry.Initialize(ctx, cfg)\nif err != nil {\n\tif strings.Contains(err.Error(), \"invalid allowedDataset format\") {\n\t\treturn fmt.Errorf(\"fix allowedDatasets syntax: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Never paste table IDs (project.dataset.table) into allowedDatasets.","Sanity-check each entry has at most one dot and no empty segments.","Keep dataset references in one canonical form (prefer fully qualified project.dataset)."],"tags":["config","validation","bigquery","datasets"],"backgroundTag":"invalid-config-value","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"}