FlowiseAI/Flowise · error · InternalFlowiseError
Error: credentialsController.getAllCredentials - workspace $
Error message
Error: credentialsController.getAllCredentials - workspace ${workspaceId} not found! What it means
Thrown by getAllCredentials when the authenticated user's activeWorkspaceId is missing from req.user. Identical root cause to the delete/workspace errors elsewhere in this controller — the GET-all path checks only workspaceId and nothing else, so the very first request a user makes after a broken login will trip this. The message interpolates the unresolved ${workspaceId} (literally 'undefined').
Source
Thrown at packages/server/src/controllers/credentials/index.ts:49
const workspaceId = req.user?.activeWorkspaceId
if (!workspaceId) {
throw new InternalFlowiseError(
StatusCodes.NOT_FOUND,
`Error: credentialsController.deleteCredentials - workspace ${workspaceId} not found!`
)
}
const apiResponse = await credentialsService.deleteCredentials(req.params.id, workspaceId)
return res.json(apiResponse)
} catch (error) {
next(error)
}
}
const getAllCredentials = async (req: Request, res: Response, next: NextFunction) => {
try {
const workspaceId = req.user?.activeWorkspaceId
if (!workspaceId) {
throw new InternalFlowiseError(
StatusCodes.NOT_FOUND,
`Error: credentialsController.getAllCredentials - workspace ${workspaceId} not found!`
)
}
const apiResponse = await credentialsService.getAllCredentials(req.query.credentialName, workspaceId)
return res.json(apiResponse)
} catch (error) {
next(error)
}
}
const getCredentialById = async (req: Request, res: Response, next: NextFunction) => {
try {
if (typeof req.params === 'undefined' || !req.params.id) {
throw new InternalFlowiseError(
StatusCodes.PRECONDITION_FAILED,
`Error: credentialsController.getCredentialById - id not provided!`
)View on GitHub (pinned to abe4a8601a)
Solutions
- Re-authenticate the user (sign out → sign in) so a fresh JWT carrying activeWorkspaceId is issued.
- Ensure the user is a member of at least one workspace; assign membership if missing.
- On the client, gate the credentials list fetch behind an activeWorkspaceId being present in the logged-in user payload.
- In tests, stub req.user with a non-empty activeWorkspaceId.
- Verify the login strategy (passport localStrategy in passport/index.ts) populates activeWorkspaceId from workspaceUser.workspaceId before calling done().
Example fix
// client-side guard before calling getAllCredentials
if (!loggedInUser.activeWorkspaceId) {
await switchWorkspace(defaultWorkspaceId)
}
const creds = await api.getAllCredentials() Defensive patterns
Strategy: validation
Validate before calling
// client guard before the credentials list fetch
function hasWorkspaceClaim(u): u is { activeWorkspaceId: string } {
return !!u && typeof u.activeWorkspaceId === 'string' && u.activeWorkspaceId.length > 0
}
if (hasWorkspaceClaim(loggedInUser)) {
const creds = await api.getAllCredentials()
} else {
// prompt workspace selection or redirect to login
} Type guard
function hasWorkspaceClaim(u: unknown): u is { activeWorkspaceId: string } {
return typeof u === 'object' && u !== null
&& typeof (u as any).activeWorkspaceId === 'string'
&& (u as any).activeWorkspaceId.length > 0
} Try / catch
try {
return await api.getAllCredentials()
} catch (e) {
if (e.status === 404 && /workspace .* not found/.test(e.message)) {
return await reauthenticateThenRetry(() => api.getAllCredentials())
}
throw e
} Prevention
- Gate any workspace-scoped API call behind a truthy activeWorkspaceId check on the client.
- Surface a 'select workspace' screen when activeWorkspaceId is missing instead of letting API calls fail.
- Re-mint the token whenever the user's workspace set changes.
When it happens
Trigger: GET /api/v1/credentials?credentialName=... issued with a JWT/session that lacks activeWorkspaceId. Common on first page-load after login when the credentials list is fetched immediately. Also fires when an API client reuses a token issued under a different platform mode.
Common situations: Frontend loads the Credentials page before the user has selected or been assigned a workspace. Token was issued for an org-only context. Cookie was cleared but stale SSR/cached token reused. Dev environment with PORTAL=true but no workspace seeded.
Related errors
- Error: credentialsController.deleteCredentials - workspace $
- Error: credentialsController.getCredentialById - workspace $
- Error: credentialsController.revealCredentialById - workspac
- Error: credentialsController.updateCredential - workspace ${
- Workspace ID is required
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/3afdfa3d13f94a0a.
Report an issue: GitHub.