Skip to content

Show "Workspace not found" instead of a 500 for a missing workspace - #187

Open
jeffmaki wants to merge 1 commit into
developfrom
fix/workspace-not-found
Open

jeffmaki wants to merge 1 commit into
developfrom
fix/workspace-not-found

Conversation

@jeffmaki

@jeffmaki jeffmaki commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Opening a page for a workspace that doesn't exist, or that the user can't access, showed Nuxt's "500 Internal Server Error" page. Those pages now show "Workspace not found" inside the app's layout, with a link back to the dashboard.

Cause

Pages under /workspace/[id] awaited workspacesClient.getWorkspace(id) at the top of setup. The API answers 404 both for a missing workspace and for one in a project group the user isn't in (WorkspaceRepository.getById filters by the user's groups). That error escaped setup, and Nuxt reports any uncaught setup error as a 500.

Changes

  • composables/loadWorkspace.ts loads the workspace and turns the API's 404, or a non-numeric id like /workspace/abc/..., into a fatal Nuxt 404 "Workspace not found". Other failures pass through unchanged.
  • Pages switched to it: settings, review, export, export/tdei, merge, merge/conflicts, projects, projects/create, projects/[projectId] and projects/[projectId]/edit. projects/index loads after mount, so it calls showError itself instead of offering a retry that can't succeed.
  • error.vue is new; the app had none. It renders errors inside the default layout, so the navbar stays:
    • A 404 shows its status text ("Workspace not found", "Page not found: /x").
    • Anything else shows "Something went wrong" and the message.
    • "View my workspaces" clears the error and goes to the dashboard. The dashboard remounts and fetches the list again, so a workspace deleted since the list loaded isn't offered again.

error.vue replaces Nuxt's default error page for every error, not only this one.

Not changed:

  • The editor pages (edit, rapid) don't fetch the workspace.
  • teams/[teamId] keeps its own "Team not found" state.

Testing

  • New unit test: test/unit/composables/loadWorkspace.test.ts.
  • New e2e spec test/e2e/error.spec.ts, written to the @test outline in error.vue. It covers:
    • each workspace page with a 404 workspace
    • a non-numeric id
    • the "View my workspaces" exit
    • an unknown address
    • an ARIA snapshot of the not-found state
  • Unit suite passes. In the full e2e suite, 192 tests passed and 7 skipped (the existing fixmes).
    • 4 new error.spec tests and 1 export-tdei test timed out on a cold dev server. Run serially, both specs pass.
    • signin and smoke failed only because the run used port 3124, since 3000 was taken locally, and they expect a redirect_uri on port 3000.

🤖 Generated with Claude Code

Summary

  • Added loadWorkspace to validate workspace IDs and convert API 404 responses into fatal Nuxt 404 errors. Other API errors pass through unchanged.
  • Updated workspace settings, review, export, merge, and project pages to use the shared loader. The projects index displays Nuxt errors through showError.
  • Added a shared error.vue page with error-specific text and a link that clears the error and returns to /dashboard.
  • Added unit and end-to-end tests for workspace-loading errors and error-page behavior.

Validation

  • CI and test results: not available.

The workspace pages fetched their workspace at the top of setup and let
the API's 404 escape, so Nuxt reported it as a 500. They now load it with
loadWorkspace, which turns that 404 (no such workspace, or one outside the
user's project groups) and a non-numeric id into a fatal 404. The new
error.vue shows it inside the app's layout, with a link back to the
dashboard that clears the error, so the dashboard loads the workspaces
again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Workspace pages now load workspace data through a shared helper. Invalid IDs and API 404 responses produce a fatal 404. A shared error page displays the error and links to the dashboard. Unit and end-to-end tests cover these behaviors.

Changes: Workspace error handling

Layer / File(s) Summary
Shared workspace loader and validation
composables/loadWorkspace.ts, test/unit/composables/loadWorkspace.test.ts, CLAUDE.md
Adds loadWorkspace to reject invalid IDs and map API 404 responses to a fatal 404. Unit tests cover success, invalid IDs, 404 conversion, other errors, and a supplied client. The guidance documents its use.
Workspace page integration
pages/workspace/[id]/export/*, pages/workspace/[id]/merge/*, pages/workspace/[id]/projects/..., pages/workspace/[id]/review.vue, pages/workspace/[id]/settings.vue
Workspace pages use loadWorkspace instead of direct workspace-client calls. The projects index passes Nuxt errors to showError in Nuxt app context and keeps other non-abort errors on its retryable error path.
Shared error display and end-to-end coverage
error.vue, test/e2e/error.spec.ts, test/e2e/error.spec.ts-snapshots/*
Adds an error page that displays a title and optional detail, with a link that clears the error and redirects to the dashboard. End-to-end tests cover workspace 404s, invalid IDs, navigation, and unknown addresses.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant ProjectIndexPage
  participant loadWorkspace
  participant workspacesClient
  participant NuxtApp
  ProjectIndexPage->>loadWorkspace: Load workspace by ID
  loadWorkspace->>workspacesClient: Request workspace
  workspacesClient-->>loadWorkspace: Return API 404
  loadWorkspace-->>ProjectIndexPage: Raise fatal Nuxt 404
  ProjectIndexPage->>NuxtApp: Run showError in app context
Loading

Possibly related PRs

Suggested reviewers: shweta2101

Merge Risk: Minimal · up to dd9ca

No actionable merge-blocking issue is identified in the workspace not-found handling. The change appears mergeable subject to normal checks.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main change: showing “Workspace not found” instead of a 500 for missing workspaces.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 3 files. (13 skipped: 13 unsupported.)

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks each workspace door
A missing one returns not-found
The error page shows where to go
A dashboard link leads home again
Tests hop through each route with care

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 12764c0c-37a3-4c2f-9748-355a513d2ed6
Commits

Reviewing files that changed from the base of the PR and between fb460a0 and dd9ca63.

Files selected for processing: 16

  • CLAUDE.md
  • composables/loadWorkspace.ts
  • error.vue
  • pages/workspace/[id]/export/index.vue
  • pages/workspace/[id]/export/tdei.vue
  • pages/workspace/[id]/merge/conflicts.vue
  • pages/workspace/[id]/merge/index.vue
  • pages/workspace/[id]/projects/[projectId]/edit.vue
  • pages/workspace/[id]/projects/[projectId]/index.vue
  • pages/workspace/[id]/projects/create.vue
  • pages/workspace/[id]/projects/index.vue
  • pages/workspace/[id]/review.vue
  • pages/workspace/[id]/settings.vue
  • test/e2e/error.spec.ts
  • test/e2e/error.spec.ts-snapshots/Workspace-not-found-ARIA-snapshot-of-the-Workspace-not-found-state-1.aria.yml
  • test/unit/composables/loadWorkspace.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant