{"record":{"id":"53b19a3a1af27280","repo":"FlowiseAI/Flowise","slug":"error-assistantscontroller-getdocumentstores-wo","errorCode":null,"errorMessage":"Error: assistantsController.getDocumentStores - workspace ${workspaceId} not found!","messagePattern":"Error: assistantsController\\.getDocumentStores - workspace (.+?) not found!","errorType":"exception","errorClass":"InternalFlowiseError","httpStatus":404,"severity":"error","filePath":"packages/server/src/controllers/assistants/index.ts","lineNumber":148,"sourceCode":"    } catch (error) {\n        next(error)\n    }\n}\n\nconst getChatModels = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        const apiResponse = await assistantsService.getChatModels()\n        return res.json(apiResponse)\n    } catch (error) {\n        next(error)\n    }\n}\n\nconst getDocumentStores = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        const workspaceId = req.user?.activeWorkspaceId\n        if (!workspaceId) {\n            throw new InternalFlowiseError(\n                StatusCodes.NOT_FOUND,\n                `Error: assistantsController.getDocumentStores - workspace ${workspaceId} not found!`\n            )\n        }\n        const apiResponse = await assistantsService.getDocumentStores(workspaceId)\n        return res.json(apiResponse)\n    } catch (error) {\n        next(error)\n    }\n}\n\nconst getTools = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        const apiResponse = await assistantsService.getTools()\n        return res.json(apiResponse)\n    } catch (error) {\n        next(error)\n    }","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/server/src/controllers/assistants/index.ts#L130-L166","documentation":"Thrown by getDocumentStores with HTTP 404 when req.user?.activeWorkspaceId is falsy. Mounted at GET /api/v1/assistants/components/docstores (routes/assistants/index.ts:21). Document stores are workspace-scoped, so an active workspace is required to list them. This handler has no id/body guard — the only precondition is the workspace.","triggerScenarios":"GET /api/v1/assistants/components/docstores from a session with no activeWorkspaceId.","commonSituations":"Assistant builder UI loading its document-store picker before workspace selection completed; session reset; user with no workspace membership.","solutions":["Ensure a workspace is selected (activeWorkspaceId in session) before loading document stores.","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 getDocumentStores()\n} catch (err) {\n  if (err?.statusCode === 404 && /workspace .* not found/i.test(err.message)) {\n    await selectWorkspace()\n    return getDocumentStores()\n  }\n  throw err\n}","preventionTips":["Load workspace-scoped component pickers only after workspace selection.","Treat workspace 404s on these reads as session-state issues.","Require activeWorkspaceId before enabling the assistant builder UI."],"tags":["authentication","session","workspace","not-found","express","flowise","assistants","document-store"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}