{"record":{"id":"8de749dd287be074","repo":"FlowiseAI/Flowise","slug":"error-assistantscontroller-getallassistants-wor","errorCode":null,"errorMessage":"Error: assistantsController.getAllAssistants - workspace ${workspaceId} not found!","messagePattern":"Error: assistantsController\\.getAllAssistants - workspace (.+?) not found!","errorType":"exception","errorClass":"InternalFlowiseError","httpStatus":404,"severity":"error","filePath":"packages/server/src/controllers/assistants/index.ts","lineNumber":73,"sourceCode":"        if (!workspaceId) {\n            throw new InternalFlowiseError(\n                StatusCodes.NOT_FOUND,\n                `Error: assistantsController.deleteAssistant - workspace ${workspaceId} not found!`\n            )\n        }\n        const apiResponse = await assistantsService.deleteAssistant(req.params.id, req.query.isDeleteBoth, workspaceId)\n        return res.json(apiResponse)\n    } catch (error) {\n        next(error)\n    }\n}\n\nconst getAllAssistants = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        const type = req.query.type as AssistantType\n        const workspaceId = req.user?.activeWorkspaceId\n        if (!workspaceId) {\n            throw new InternalFlowiseError(\n                StatusCodes.NOT_FOUND,\n                `Error: assistantsController.getAllAssistants - workspace ${workspaceId} not found!`\n            )\n        }\n        const apiResponse = await assistantsService.getAllAssistants(workspaceId, type)\n        return res.json(apiResponse)\n    } catch (error) {\n        next(error)\n    }\n}\n\nconst getAssistantById = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        if (typeof req.params === 'undefined' || !req.params.id) {\n            throw new InternalFlowiseError(\n                StatusCodes.PRECONDITION_FAILED,\n                `Error: assistantsController.getAssistantById - id not provided!`\n            )","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/server/src/controllers/assistants/index.ts#L55-L91","documentation":"Thrown by getAllAssistants with HTTP 404 when req.user?.activeWorkspaceId is falsy. Mounted at GET /api/v1/assistants (routes/assistants/index.ts:11). Because assistants are workspace-scoped, listing requires an active workspace; note this handler reads req.query.type before the workspace check, but that read is side-effect-free and does not change the outcome.","triggerScenarios":"GET /api/v1/assistants (optionally ?type=...) from a session with no activeWorkspaceId.","commonSituations":"Loading the assistants list right after login before workspace selection completes; session lost mid-session; user with no workspace membership.","solutions":["Ensure a workspace is selected (activeWorkspaceId in session) before fetching the list.","Verify auth middleware and workspace membership."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"const hasActiveWorkspace = (u: unknown): u is { activeWorkspaceId: string } =>\n  !!u && typeof u === 'object' &&\n  typeof (u as any).activeWorkspaceId === 'string' &&\n  (u as any).activeWorkspaceId.length > 0","tryCatchPattern":"try {\n  return await getAllAssistants()\n} catch (err) {\n  if (err?.statusCode === 404 && /workspace .* not found/i.test(err.message)) {\n    await selectWorkspace()\n    return getAllAssistants()\n  }\n  throw err\n}","preventionTips":["Block listing assistants until a workspace is selected post-login.","Treat a workspace 404 on list calls as a session-state issue, not a missing-resource issue.","Centralize the select-workspace-then-retry pattern."],"tags":["authentication","session","workspace","not-found","express","flowise","assistants"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}