{"record":{"id":"963648508f07f7ce","repo":"bytebase/bytebase","slug":"failed-to-batch-list-issues","errorCode":null,"errorMessage":"failed to batch list issues","messagePattern":"failed to batch list issues","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/api/v1/plan_service.go","lineNumber":861,"sourceCode":"\tfor _, plan := range plans {\n\t\tplanUIDs = append(planUIDs, plan.UID)\n\t\tif plan.Config != nil && plan.Config.HasRollout {\n\t\t\trolloutPlanUIDs = append(rolloutPlanUIDs, plan.UID)\n\t\t}\n\t\tprojectIDSet[plan.ProjectID] = struct{}{}\n\t}\n\tprojectIDs := make([]string, 0, len(projectIDSet))\n\tfor projectID := range projectIDSet {\n\t\tprojectIDs = append(projectIDs, projectID)\n\t}\n\n\tissues, err := s.ListIssues(ctx, &store.FindIssueMessage{\n\t\tWorkspace:  workspaceID,\n\t\tProjectIDs: projectIDs,\n\t\tPlanUIDs:   &planUIDs,\n\t})\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to batch list issues\")\n\t}\n\tissueByPlanKey := make(map[planKey]*store.IssueMessage, len(issues))\n\tfor _, issue := range issues {\n\t\tif issue.PlanUID != nil {\n\t\t\tissueByPlanKey[planKey{projectID: issue.ProjectID, planUID: *issue.PlanUID}] = issue\n\t\t}\n\t}\n\n\tplanCheckRuns, err := s.ListPlanCheckRuns(ctx, &store.FindPlanCheckRunMessage{\n\t\tProjectIDs: &projectIDs,\n\t\tPlanUIDs:   &planUIDs,\n\t})\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to batch list plan check runs\")\n\t}\n\tplanCheckRunByPlanKey := make(map[planKey]*store.PlanCheckRunMessage, len(planCheckRuns))\n\tfor _, run := range planCheckRuns {\n\t\tplanCheckRunByPlanKey[planKey{projectID: run.ProjectID, planUID: run.PlanUID}] = run","sourceCodeStart":843,"sourceCodeEnd":879,"githubUrl":"https://github.com/bytebase/bytebase/blob/1870550677fe08f0d2a78c07acd27541464eb945/backend/api/v1/plan_service.go#L843-L879","documentation":"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.","triggerScenarios":"ListPlans or convertToPlan when the ListIssues store query fails: metadata database down, timeout, or SQL error for the batched plan UID filter.","commonSituations":"Metadata Postgres outage or saturation; large batched plan UID lists causing slow queries/timeouts; transient network faults.","solutions":["Retry the list request","Check metadata database health and slow-query logs","Inspect the wrapped error for the root store failure"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const plans = await planClient.listPlans(req);\n} catch (e) {\n  if (/failed to batch list issues/.test(e.message)) {\n    await retryWithBackoff(() => planClient.listPlans(req));\n  }\n}","preventionTips":["Monitor metadata database health and slow queries","Bound plan-list page sizes to keep issue batch lookups small","Add retry with backoff for transient store errors"],"tags":["issue","store","list"],"backgroundTag":"database-query-failed","analyzedSha":"1870550677fe08f0d2a78c07acd27541464eb945","analyzedAt":"2026-09-06T21:16:13.665Z","contentChangedAt":"2026-09-06T21:16:13.665Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}