{"record":{"id":"494b5f35b0b6c8d9","repo":"multica-ai/multica","slug":"failed-to-load-project-data-for-export","errorCode":null,"errorMessage":"Failed to load project data for export","messagePattern":"Failed to load project data for export","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/views/issues/surface/use-issue-surface-data.ts","lineNumber":298,"sourceCode":"    enabled: loadProjects,\n  });\n  const projects = projectData ?? EMPTY_PROJECTS;\n  const projectMap = useMemo(\n    () => new Map(projects.map((project) => [project.id, project])),\n    [projects],\n  );\n  const resolveTableExportLookups = useCallback(\n    async (needs: { projects: boolean; childProgress: boolean }) => {\n      const [projectResult, progressResult] = await Promise.all([\n        needs.projects ? refetchProjects() : Promise.resolve(null),\n        needs.childProgress\n          ? refetchChildProgress()\n          : Promise.resolve(null),\n      ]);\n      if (projectResult?.error) throw projectResult.error;\n      if (progressResult?.error) throw progressResult.error;\n      if (needs.projects && !projectResult?.data) {\n        throw new Error(\"Failed to load project data for export\");\n      }\n      if (needs.childProgress && !progressResult?.data) {\n        throw new Error(\"Failed to load child progress for export\");\n      }\n      const resolvedProjects = projectResult?.data ?? projects;\n      return {\n        projectMap: new Map(\n          resolvedProjects.map((project) => [project.id, project]),\n        ),\n        childProgressMap: progressResult?.data ?? childProgressMap,\n      };\n    },\n    [\n      childProgressMap,\n      projects,\n      refetchChildProgress,\n      refetchProjects,\n    ],","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/packages/views/issues/surface/use-issue-surface-data.ts#L280-L316","documentation":"Thrown by resolveTableExportLookups in use-issue-surface-data.ts when a table export needs project lookups, the refetch completed without an error, but projectResult.data is still empty/undefined. This distinguishes 'refetch errored' (the earlier throw of projectResult.error) from 'refetch succeeded but yielded no data', which would otherwise produce an export with unresolvable project names.","triggerScenarios":"Exporting the issues table with a project column visible while the projects query resolves to an empty dataset (e.g. query disabled, workspace with no projects but stale column config, or React Query returning undefined data on a successful empty fetch); refetchProjects resolving after unmount so data is undefined.","commonSituations":"Column settings referencing project fields persisted from another workspace; projects query key scoped to a workspace the user just left; race between export click and query teardown.","solutions":["Retry the export — transient empty refetch results usually resolve on the second attempt.","Verify the workspace actually has projects and the projects query is enabled for the current workspace id.","Remove the project column from the export if project metadata is not needed.","If developing: ensure the projects query is not disabled during export and that data defaults to [] rather than undefined on empty results."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before export: confirm project data is actually present\nif (needs.projects && !projects?.length) {\n  await refetchProjects();\n}","typeGuard":null,"tryCatchPattern":"try {\n  const lookups = await resolveTableExportLookups({ projects: true, childProgress: false });\n} catch (err) {\n  notifyExportBlocked(err instanceof Error ? err.message : \"export lookups unavailable\");\n}","preventionTips":["Keep export-dependent queries enabled and warm while the table is visible.","Default query data to [] (not undefined) for empty workspaces so successful-but-empty never trips the guard.","Disable the export button until required lookups have data."],"tags":["export","react-query","projects","issues-surface","typescript"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}