bytebase/bytebase · error

failed to batch list issues

Error message

failed to batch list issues

What it means

convertToPlans wraps store errors from s.ListIssues with this message while enriching plans with their associated issues. It is a wrapped internal failure, not a user-input problem — the issue batch lookup by workspace/project/plan UIDs failed.

Source

Thrown at backend/api/v1/plan_service.go:861

	for _, plan := range plans {
		planUIDs = append(planUIDs, plan.UID)
		if plan.Config != nil && plan.Config.HasRollout {
			rolloutPlanUIDs = append(rolloutPlanUIDs, plan.UID)
		}
		projectIDSet[plan.ProjectID] = struct{}{}
	}
	projectIDs := make([]string, 0, len(projectIDSet))
	for projectID := range projectIDSet {
		projectIDs = append(projectIDs, projectID)
	}

	issues, err := s.ListIssues(ctx, &store.FindIssueMessage{
		Workspace:  workspaceID,
		ProjectIDs: projectIDs,
		PlanUIDs:   &planUIDs,
	})
	if err != nil {
		return nil, errors.Wrap(err, "failed to batch list issues")
	}
	issueByPlanKey := make(map[planKey]*store.IssueMessage, len(issues))
	for _, issue := range issues {
		if issue.PlanUID != nil {
			issueByPlanKey[planKey{projectID: issue.ProjectID, planUID: *issue.PlanUID}] = issue
		}
	}

	planCheckRuns, err := s.ListPlanCheckRuns(ctx, &store.FindPlanCheckRunMessage{
		ProjectIDs: &projectIDs,
		PlanUIDs:   &planUIDs,
	})
	if err != nil {
		return nil, errors.Wrap(err, "failed to batch list plan check runs")
	}
	planCheckRunByPlanKey := make(map[planKey]*store.PlanCheckRunMessage, len(planCheckRuns))
	for _, run := range planCheckRuns {
		planCheckRunByPlanKey[planKey{projectID: run.ProjectID, planUID: run.PlanUID}] = run

View on GitHub (pinned to 1870550677)

Solutions

  1. Retry the list request
  2. Check metadata database health and slow-query logs
  3. Inspect the wrapped error for the root store failure
Defensive patterns

Strategy: retry

Try / catch

try {
  const plans = await planClient.listPlans(req);
} catch (e) {
  if (/failed to batch list issues/.test(e.message)) {
    await retryWithBackoff(() => planClient.listPlans(req));
  }
}

Prevention

When it happens

Trigger: ListPlans or convertToPlan when the ListIssues store query fails: metadata database down, timeout, or SQL error for the batched plan UID filter.

Common situations: Metadata Postgres outage or saturation; large batched plan UID lists causing slow queries/timeouts; transient network faults.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of bytebase/bytebase@1870550677 (2026-09-06). Data as JSON: /api/errors/963648508f07f7ce. Report an issue: GitHub.