Infinite loading spinner when creating an issue while unauthenticated via work_items/new

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

When an unauthenticated user navigates to the work_items/new page (e.g. via a public project's "New item" button) they are able to fill in the issue form and click "Create issue". The UI shows an infinite loading spinner on the "Create Issue" button and never recovers.

The root cause appears to be that the createWorkItem GraphQL mutation fails for unauthenticated users (the server returns an error or a null/empty response), but the frontend does not handle this gracefully — it attempts to use the id from the response (which is undefined) and throws an unhandled error, leaving the spinner stuck indefinitely.

A user followed the instructions on our forum to file a bug, but they did not have an account. The current instructions do not note that users must be signed in to create a bug report.

Steps to reproduce

  1. Open an incognito/private browsing window (ensure you are not signed in to GitLab)
  2. Navigate to a public project's issue tracker and click the New item button, or go directly to: https://gitlab.com/gitlab-org/gitlab/-/work_items/new?type=Issue&initialCreationContext=list-route
  3. Select type Issue
  4. Fill in a Title (required)
  5. Click the Create issue button

What is the current bug behavior?

  • A loading spinner ("donut") appears and never goes away

  • The JavaScript console reports:

    Uncaught TypeError: id must be a number or string; got undefined
        at p (utils.js:85:11)
        at S (cache_utils.js:945:25)
        at o.processWorkItemTypes (create_work_item.vue:792:1)
        at o.result (create_work_item.vue:318:1)
  • The user receives no error message and cannot recover without refreshing the page

What is the expected correct behavior?

One of the following should happen:

  • The user is redirected to the sign-in page before creating the issue
  • A clear, user-facing error message is shown (e.g. "You must be signed in to create an issue")
  • The loading state is cleared and the form remains usable

Environment

  • Reproduced on GitLab.com

Relevant details

  • The work_items/new page is accessible to unauthenticated users on public projects, but the createWorkItem GraphQL mutation requires authentication
  • The frontend does not check authentication state before submitting, nor does it handle the resulting error response gracefully
  • The id field on the returned work item is undefined (due to the failed mutation), causing the subsequent JS error
Edited by 🤖 GitLab Bot 🤖