{"record":{"id":"5a290b3fc10e56b1","repo":"nocodb/nocodb","slug":"workspace-not-selected","errorCode":null,"errorMessage":"Workspace not selected","messagePattern":"Workspace not selected","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/nc-gui/store/bases.ts","lineNumber":166,"sourceCode":"          isLoading: false,\n        })\n\n        return\n      } catch (e: any) {\n        if (e?.response?.status === 404) {\n          return router.push('/error/404')\n        }\n        throw e\n      } finally {\n        isProjectsLoaded.value = true\n      }\n    }\n\n    const activeWorkspace = workspaceStore.activeWorkspace\n    const workspace = workspaceStore.workspace\n\n    if ((!page || page === 'workspace') && !workspace?.id && !activeWorkspace?.id) {\n      throw new Error('Workspace not selected')\n    }\n\n    let _projects: BaseType[] = []\n\n    isProjectsLoading.value = true\n    try {\n      const { list } = await $api.base.list({\n        baseURL: getBaseUrl(activeWorkspace?.id ?? workspace?.id),\n      })\n      _projects = list\n\n      bases.value = _projects.reduce((acc, base) => {\n        const existingProjectMeta = bases.value.get(base.id!) || {}\n        acc.set(base.id!, {\n          ...existingProjectMeta,\n          ...base,\n          isExpanded: route.value.params.baseId === base.id || bases.value.get(base.id!)?.isExpanded,\n          isLoading: false,","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/nocodb/nocodb/blob/d3caaf4e890acf64bd49b788cf6dc32b7644c895/packages/nc-gui/store/bases.ts#L148-L184","documentation":"In store/bases.loadProjects, when listing for the workspace/home page the code requires an active workspace context. If neither workspace.id nor activeWorkspace.id is set, it throws 'Workspace not selected' before calling $api.base.list, because the list request needs a workspace-scoped baseURL.","triggerScenarios":"Navigating to the workspace or home page before a workspace has been chosen/loaded; workspace store cleared (e.g. after logout) while a stale route triggers loadProjects; route enters with page === 'workspace' but no workspaceId in store.","commonSituations":"Post-logout navigation; deep links that land on the workspace page without a workspace id param; multi-workspace switching where the active workspace is reset to undefined mid-transition.","solutions":["Ensure a workspace is selected (activeWorkspaceId resolved) before navigating to the workspace page.","Redirect to a workspace-picker or onboarding route when no workspace is active.","Seed activeWorkspace from the route param or first available workspace on app init.","Guard the route with a middleware that requires workspaceId."],"exampleFix":"// before\nif ((!page || page === 'workspace') && !workspace?.id && !activeWorkspace?.id) throw new Error('Workspace not selected')\n// after\nif ((!page || page === 'workspace') && !workspace?.id && !activeWorkspace?.id) { await router.push('/workspaces'); return }","handlingStrategy":"validation","validationCode":"const wsId = activeWorkspace?.id ?? workspace?.id\nif ((!page || page === 'workspace') && !wsId) {\n  await router.push('/workspaces')\n  return\n}","typeGuard":"const hasWorkspace = (a?: { id?: string }, w?: { id?: string }): boolean =>\n  !!a?.id || !!w?.id","tryCatchPattern":"try {\n  await loadProjects(page)\n} catch (e) {\n  if ((e as Error).message === 'Workspace not selected') {\n    await router.push('/workspaces')\n  } else throw e\n}","preventionTips":["Resolve a workspace before navigating to the workspace page.","Seed activeWorkspace from route params or first workspace on init.","Clear routes that depend on workspace after logout."],"tags":["workspace","store","navigation","precondition"],"backgroundTag":null,"analyzedSha":"d3caaf4e890acf64bd49b788cf6dc32b7644c895","analyzedAt":"2026-08-12T13:07:32.092Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}