multica-ai/multica · error

Failed to load project data for export

Error message

Failed to load project data for export

What it means

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.

Source

Thrown at packages/views/issues/surface/use-issue-surface-data.ts:298

    enabled: loadProjects,
  });
  const projects = projectData ?? EMPTY_PROJECTS;
  const projectMap = useMemo(
    () => new Map(projects.map((project) => [project.id, project])),
    [projects],
  );
  const resolveTableExportLookups = useCallback(
    async (needs: { projects: boolean; childProgress: boolean }) => {
      const [projectResult, progressResult] = await Promise.all([
        needs.projects ? refetchProjects() : Promise.resolve(null),
        needs.childProgress
          ? refetchChildProgress()
          : Promise.resolve(null),
      ]);
      if (projectResult?.error) throw projectResult.error;
      if (progressResult?.error) throw progressResult.error;
      if (needs.projects && !projectResult?.data) {
        throw new Error("Failed to load project data for export");
      }
      if (needs.childProgress && !progressResult?.data) {
        throw new Error("Failed to load child progress for export");
      }
      const resolvedProjects = projectResult?.data ?? projects;
      return {
        projectMap: new Map(
          resolvedProjects.map((project) => [project.id, project]),
        ),
        childProgressMap: progressResult?.data ?? childProgressMap,
      };
    },
    [
      childProgressMap,
      projects,
      refetchChildProgress,
      refetchProjects,
    ],

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Retry the export — transient empty refetch results usually resolve on the second attempt.
  2. Verify the workspace actually has projects and the projects query is enabled for the current workspace id.
  3. Remove the project column from the export if project metadata is not needed.
  4. If developing: ensure the projects query is not disabled during export and that data defaults to [] rather than undefined on empty results.
Defensive patterns

Strategy: validation

Validate before calling

// Before export: confirm project data is actually present
if (needs.projects && !projects?.length) {
  await refetchProjects();
}

Try / catch

try {
  const lookups = await resolveTableExportLookups({ projects: true, childProgress: false });
} catch (err) {
  notifyExportBlocked(err instanceof Error ? err.message : "export lookups unavailable");
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/494b5f35b0b6c8d9. Report an issue: GitHub.