bytebase/bytebase · error
plan contains both database group and databases, but only on
Error message
plan contains both database group and databases, but only one is allowed
What it means
A plan spec must select its target databases via exactly one mechanism: a database group, or an explicit list of databases. validateSpecs rejects CreatePlan/UpdatePlan requests that set both a database group resource and explicit database resources in the same plan, because the combined targeting semantics would be ambiguous.
Source
Thrown at backend/api/v1/plan_service.go:678
}
// Allow at most one ChangeDatabaseConfig with release.
if releaseCount > 1 {
return nil, errors.Errorf("plan contains multiple change database configs with release, but only one is allowed")
}
// Allow at most one instance.
if len(instanceTargets) > 1 {
return nil, errors.Errorf("plan contains targets on multiple instances, but only one instance is allowed")
}
// Allow at most one database group.
if len(databaseGroups) > 1 {
return nil, errors.Errorf("plan contains multiple database groups, but only one is allowed")
}
// Don't allow mixing database group and databases.
if len(databaseGroups) > 0 && len(databaseNames) > 0 {
return nil, errors.Errorf("plan contains both database group and databases, but only one is allowed")
}
// Validate resources existence.
if len(instanceTargets) == 1 {
instance, err := getInstanceMessage(ctx, s, instanceTargets[0])
if err != nil {
return nil, err
}
if instance.Deleted {
return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("instance %q has been deleted", instanceTargets[0]))
}
}
if len(databaseGroups) == 1 {
name := databaseGroups[0]
groupProjectID, _, err := common.GetProjectIDDatabaseGroupID(name)
if err != nil {
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("invalid database group name %q", name))View on GitHub (pinned to 1870550677)
Solutions
- Remove the explicit database resources and keep only the database group spec
- Remove the database group spec and keep only the explicit database list
- If both targets are needed, issue separate plans — one per targeting style
Example fix
// before
plan.specs = [{databaseGroup: "projects/p/databaseGroups/prod"},
{databases: ["projects/p/databases/db1"]}]
// after
plan.specs = [{databaseGroup: "projects/p/databaseGroups/prod"}] Defensive patterns
Strategy: validation
Validate before calling
if len(spec.GetDatabaseGroup()) > 0 && len(spec.GetDatabases()) > 0 {
return fmt.Errorf("spec sets both databaseGroup and databases; pick one")
} Try / catch
var cerr *connect.Error
if errors.As(err, &cerr) && strings.Contains(cerr.Message(), "both database group and databases") {
// clear one targeting style and resubmit
} Prevention
- Model targeting mode as an enum in client code so only one field can be set
- Clear the databases list whenever a group is selected (and vice versa) in UI code
When it happens
Trigger: Calling CreatePlan or UpdatePlan where plan specs contain both a database_group resource name and database resource names (e.g. projects/{p}/databases/{db}) simultaneously — typically when a client appends a fallback database entry alongside a group, or merges two different spec styles.
Common situations: UI or tooling that pre-fills explicit databases and then adds a group when the user changes selection mode without clearing the other field; migration of older plan payloads that mixed both styles; hand-written API scripts constructing specs incorrectly.
Related errors
- plan contains multiple database groups, but only one is allo
- invalid_argument
- CodeInvalidArgument
- cannot set both %s and %s; clear one of them by including th
- failed to get database group %q
AI-assisted analysis of bytebase/bytebase@1870550677 (2026-09-06).
Data as JSON: /api/errors/6d49f887fbfdb27d.
Report an issue: GitHub.