hoppscotch/hoppscotch · error · Error

Team Collection Updated Error: ${JSON.stringify(result.left)

Error message

Team Collection Updated Error: ${JSON.stringify(result.left)}

What it means

Thrown inside the TeamCollectionUpdated GraphQL subscription callback in registerSubscriptions() when the subscription delivers a Left result. This callback handles real-time collection-title/data updates and clears the loadingCollections flag for the updated collection. Throwing in the next-handler risks crashing the RxJS chain and leaves loadingCollections stuck.

Source

Thrown at packages/hoppscotch-common/src/services/team-collection.service.ts:736

          requests: null,
          title: result.right.teamCollectionAdded.title,
          data: result.right.teamCollectionAdded.data ?? null,
        },
        result.right.teamCollectionAdded.parent?.id ?? null
      )
    })

    const [teamCollUpdated$, teamCollUpdatedSub] = runGQLSubscription({
      query: TeamCollectionUpdatedDocument,
      variables: {
        teamID: this.teamID,
      },
    })

    this.teamCollectionUpdatedSub = teamCollUpdatedSub
    this.teamCollectionUpdated$ = teamCollUpdated$.subscribe((result: any) => {
      if (E.isLeft(result))
        throw new Error(
          `Team Collection Updated Error: ${JSON.stringify(result.left)}`
        )

      this.updateCollection({
        id: result.right.teamCollectionUpdated.id,
        title: result.right.teamCollectionUpdated.title,
        data: result.right.teamCollectionUpdated.data,
      })

      this.loadingCollections.value = this.loadingCollections.value.filter(
        (x) => x !== result.right.teamCollectionUpdated.id
      )
    })

    const [teamCollRemoved$, teamCollRemovedSub] = runGQLSubscription({
      query: TeamCollectionRemovedDocument,
      variables: {
        teamID: this.teamID,

View on GitHub (pinned to 1acb8a3a75)

Solutions

  1. Move the error path to a dedicated subscribe error handler instead of throwing in next.
  2. Ensure loadingCollections is cleared in the error path to avoid a stuck loading spinner.
  3. Re-register subscriptions on transient errors; re-authenticate on auth errors.
  4. Log result.left for backend error diagnosis.

Example fix

// before
this.teamCollectionUpdated$ = teamCollUpdated$.subscribe((result: any) => {
  if (E.isLeft(result))
    throw new Error(`Team Collection Updated Error: ${JSON.stringify(result.left)}`)
  this.updateCollection(...)
  this.loadingCollections.value = this.loadingCollections.value.filter(...)
})

// after
this.teamCollectionUpdated$ = teamCollUpdated$.subscribe({
  next: (result: any) => {
    if (E.isLeft(result)) {
      console.error('TeamCollectionUpdated error:', result.left)
      return
    }
    this.updateCollection(...)
    this.loadingCollections.value = this.loadingCollections.value.filter(...)
  },
  error: (err) => { console.error('TeamCollectionUpdated stream error:', err) },
})
Defensive patterns

Strategy: try-catch

Try / catch

this.teamCollectionUpdated$ = teamCollUpdated$.subscribe({
  next: (result: any) => {
    if (E.isLeft(result)) {
      console.error('TeamCollectionUpdated error:', result.left)
      // Clear loadingCollections to avoid stuck spinner
      return
    }
    this.updateCollection(...)
  },
  error: (err) => { console.error('TeamCollectionUpdated stream error:', err) },
})

Prevention

When it happens

Trigger: The TeamCollectionUpdated subscription emits an error — WebSocket drop, backend GraphQL error, expired auth, or invalid teamID. The error leaves the loadingCollections entry for the in-flight collection uncleared.

Common situations: Auth token expired mid-subscription; network interruption; backend restart; team access revoked while subscribed; concurrent update event arriving in a format the client doesn't expect.

Related errors


AI-assisted analysis of hoppscotch/hoppscotch@1acb8a3a75 (2026-08-12). Data as JSON: /api/errors/cc5fa43e3d4e2887. Report an issue: GitHub.