Skip to content

Adding or syncing an instrument repository reports failure after 10 seconds while the import keeps running #1738

Closed

Description

@joshunrau

Adding or syncing an instrument repository is reported as failed after 10 seconds, while the server carries on and finishes the import. The axios interceptor aborts every request after 10 s unless it opts out with meta.disableDefaultTimeout. useCreateInstrumentRepoMutation and useSyncInstrumentRepoMutation do not opt out. Both endpoints download the repository's zipball from GitHub (the server allows 60 s for that alone) and then run esbuild over every instrument in it. The Add Repository dialog warns "Importing may take a minute", and the sync hook's own comment calls the sync "potentially slow". For any repository with more than a handful of instruments, the browser times out first. The admin sees "Failed to import repository" / "Failed to sync repository", then the error page (#1731). The repository then shows up imported after a reload. A retry of the import is treated by the API as a re-sync, so it times out again the same way.

Where

apps/web/src/hooks/useCreateInstrumentRepoMutation.ts:15-16:

mutationFn: ({ data }: { data: $CreateInstrumentRepoData }) =>
  axios.post('/v1/instrument-repos', data, { meta: { disableDefaultErrorNotification: true } }),

apps/web/src/hooks/useSyncInstrumentRepoMutation.ts:14-15:

mutationFn: ({ id }: { id: string }) =>
  axios.post(`/v1/instrument-repos/${id}/sync`, undefined, { meta: { disableDefaultErrorNotification: true } }),

apps/web/src/services/axios.ts:108-109, the default being hit:

if (!config.meta?.disableDefaultTimeout) {
  config.timeout = 10000; // abort request after 10 seconds

Reproduce

  1. As an admin, open Admin Panel → Instrument Repos → Add Repository.
  2. Enter a GitHub instrument repository whose import takes longer than 10 s (any repository with a few dozen instruments, or any repository on a slow link to GitHub).

Actual: after 10 s the request is aborted and "Failed to import repository" is shown. Reloading the page shows the repository was imported.
Expected: the client waits for the import to finish, and reports success or the server's actual error.

Tests

  • apps/web/src/hooks/__tests__/useCreateInstrumentRepoMutation.test.ts and useSyncInstrumentRepoMutation.test.ts: it('should opt out of the default request timeout, since an import can outlast it'), asserting the request config carries meta.disableDefaultTimeout: true.
  • testing/src/specs/admin-instrument-repos.spec.ts: route POST **/v1/instrument-repos to answer after 12 s, and assert the dialog reports success rather than failure.

Suggested fix

Pass meta: { disableDefaultErrorNotification: true, disableDefaultTimeout: true } on both requests, as useCreateSetupStateMutation does for the similarly slow /v1/setup. Optionally set an explicit timeout a little above the server's 60 s download budget plus bundling time.

Activity

  1. added
    BugType: existing behavior is wrong
    Difficulty: LowIsolated change, about 2 hours or less
    Area: Webapps/web (clinician-facing React SPA)
    Good First IssueWell-scoped, low-risk and self-contained; a good entry point for a new contributor
    on Oct 7, 2026
  2. added a commit that references this issue on Oct 29, 2026
    9945d6d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: Webapps/web (clinician-facing React SPA)BugType: existing behavior is wrongDifficulty: LowIsolated change, about 2 hours or lessGood First IssueWell-scoped, low-risk and self-contained; a good entry point for a new contributorPriority: MediumReal value; schedule normally

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions