{"record":{"id":"7ff15c4b14d981d6","repo":"googleapis/mcp-toolbox","slug":"external-query-is-not-allowed-when-dataset-restric","errorCode":null,"errorMessage":"EXTERNAL_QUERY is not allowed when dataset restrictions are in place","messagePattern":"EXTERNAL_QUERY is not allowed when dataset restrictions are in place","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/bigquery/bigquerycommon/table_name_parser.go","lineNumber":234,"sourceCode":"\t\t\tif char == '\"' {\n\t\t\t\tstate = stateInDoubleQuoteString\n\t\t\t\ti++\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif unicode.IsLetter(char) || char == '`' {\n\t\t\t\tparts, consumed, err := parseIdentifierSequence(remaining)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn 0, err\n\t\t\t\t}\n\t\t\t\tif consumed == 0 {\n\t\t\t\t\ti++\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tfor _, part := range parts {\n\t\t\t\t\tif strings.EqualFold(part, \"EXTERNAL_QUERY\") {\n\t\t\t\t\t\treturn 0, fmt.Errorf(\"EXTERNAL_QUERY is not allowed when dataset restrictions are in place\")\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Check for INFORMATION_SCHEMA\n\t\t\t\tinfoSchemaIdx := -1\n\t\t\t\tfor idx, part := range parts {\n\t\t\t\t\tif strings.EqualFold(part, \"INFORMATION_SCHEMA\") {\n\t\t\t\t\t\tinfoSchemaIdx = idx\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif infoSchemaIdx != -1 {\n\t\t\t\t\tviewName := parts[len(parts)-1]\n\t\t\t\t\tif !datasetLevelInformationSchemaViews[strings.ToLower(viewName)] {\n\t\t\t\t\t\treturn 0, fmt.Errorf(\"querying non-dataset-level INFORMATION_SCHEMA view %q is not allowed when dataset restrictions are in place\", viewName)\n\t\t\t\t\t}\n\t\t\t\t\tif infoSchemaIdx == 0 {\n\t\t\t\t\t\treturn 0, fmt.Errorf(\"querying INFORMATION_SCHEMA views without a dataset prefix is not allowed when dataset restrictions are in place\")","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/bigquery/bigquerycommon/table_name_parser.go#L216-L252","documentation":"The SQL scanner found the EXTERNAL_QUERY function in a statement while dataset restrictions are active for this BigQuery tool — EXTERNAL_QUERY escapes BigQuery and its target cannot be analyzed against the allowed datasets.","triggerScenarios":"Thrown at internal/tools/bigquery/bigquerycommon/table_name_parser.go:234 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove EXTERNAL_QUERY from the statement","Query the external data through a permitted BigQuery dataset instead","Relax dataset restrictions if federated access is intended"],"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"}