googleapis/mcp-toolbox · error
query contains table '%s' without project ID, and no default
Error message
query contains table '%s' without project ID, and no default project ID is provided
What it means
formatTableID builds fully-qualified project.dataset.table IDs so table access can be checked against dataset restrictions. A reference with only dataset.table cannot be resolved without a default project; if no defaultProjectID was supplied to the parser, it fails rather than guessing the project.
Source
Thrown at internal/tools/bigquery/bigquerycommon/table_name_parser.go:473
}
totalConsumed++
}
return parts, totalConsumed, nil
}
func formatTableID(parts []string, defaultProjectID string) (string, error) {
if len(parts) < 2 || len(parts) > 3 {
// Not a table identifier (could be a CTE, column, etc.).
// Return the consumed length so the main loop can skip this identifier.
return "", nil
}
var tableID string
if len(parts) == 3 { // project.dataset.table
tableID = strings.Join(parts, ".")
} else { // dataset.table
if defaultProjectID == "" {
return "", fmt.Errorf("query contains table '%s' without project ID, and no default project ID is provided", strings.Join(parts, "."))
}
tableID = fmt.Sprintf("%s.%s", defaultProjectID, strings.Join(parts, "."))
}
return tableID, nil
}
View on GitHub (pinned to 8cc6e09de2)
Solutions
- Configure the BigQuery source with a project ID so the parser has a defaultProjectID
- Fully qualify table references as project.dataset.table in the query
- Pass a default project when constructing the TableParser
Example fix
// before
TableParser{DefaultProjectID: ""} with query: SELECT * FROM mydataset.mytable
// after
TableParser{DefaultProjectID: "my-project"} -- or query:
SELECT * FROM my-project.mydataset.mytable Defensive patterns
Strategy: validation
Validate before calling
if parser.DefaultProjectID == "" && usesTwoPartTableName(sql) {
return fmt.Errorf("source has no default project; fully qualify tables as project.dataset.table")
} Try / catch
tables, err := parser.Parse(sql)
if err != nil && strings.Contains(err.Error(), "no default project ID") {
// re-parse with an explicit default project, or ask user to qualify tables
return err
} Prevention
- Always configure a project ID on the BigQuery source
- Write fully-qualified project.dataset.table references in shared SQL
- Assert a non-empty project ID at server startup in tests
When it happens
Trigger: parseSQL encounters a dataset.table (2-part) reference while TableParser was constructed with an empty defaultProjectID (e.g. no project passed from the source config).
Common situations: Source configured without a BigQuery project ID while queries use unqualified table names; shared SQL written assuming a default project; environment-dependent configs where the default project is unset in prod.
Related errors
- EXECUTE IMMEDIATE is not allowed when dataset restrictions a
- unanalyzable statements like '%s %s' are not allowed
- dataset-level operations like '%s %s' are not allowed when d
- unclosed subquery parenthesis
- unclosed backtick identifier
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/1d0d3a0928052f21.
Report an issue: GitHub.