FlowiseAI/Flowise · warning · InternalFlowiseError

Error: assistantsController.getAssistantById - id not provid

Error message

Error: assistantsController.getAssistantById - id not provided!

What it means

Thrown by getAssistantById with HTTP 412 when req.params is undefined or req.params.id is falsy. Mounted via routes/assistants/index.ts:12 as GET ['/', '/:id'], so GET /api/v1/assistants/ (root) reaches getAssistantById with no id and throws.

Source

Thrown at packages/server/src/controllers/assistants/index.ts:88

        const type = req.query.type as AssistantType
        const workspaceId = req.user?.activeWorkspaceId
        if (!workspaceId) {
            throw new InternalFlowiseError(
                StatusCodes.NOT_FOUND,
                `Error: assistantsController.getAllAssistants - workspace ${workspaceId} not found!`
            )
        }
        const apiResponse = await assistantsService.getAllAssistants(workspaceId, type)
        return res.json(apiResponse)
    } catch (error) {
        next(error)
    }
}

const getAssistantById = async (req: Request, res: Response, next: NextFunction) => {
    try {
        if (typeof req.params === 'undefined' || !req.params.id) {
            throw new InternalFlowiseError(
                StatusCodes.PRECONDITION_FAILED,
                `Error: assistantsController.getAssistantById - id not provided!`
            )
        }
        const workspaceId = req.user?.activeWorkspaceId
        if (!workspaceId) {
            throw new InternalFlowiseError(
                StatusCodes.NOT_FOUND,
                `Error: assistantsController.getAssistantById - workspace ${workspaceId} not found!`
            )
        }
        const apiResponse = await assistantsService.getAssistantById(req.params.id, workspaceId)
        return res.json(apiResponse)
    } catch (error) {
        next(error)
    }
}

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Call GET /api/v1/assistants/<id> with a concrete id.
  2. Guard id client-side before fetching.

Example fix

// before
await fetch(`${BASE}/api/v1/assistants/`, { headers })

// after
if (!assistantId) throw new Error('assistant id required')
await fetch(`${BASE}/api/v1/assistants/${encodeURIComponent(assistantId)}`, { headers })
Defensive patterns

Strategy: validation

Validate before calling

function assertId(id: unknown): string {
  if (typeof id !== 'string' || id.trim() === '') {
    throw new Error('assistant id is required')
  }
  return id
}
const id = assertId(selectedId)
await fetch(`${BASE}/api/v1/assistants/${encodeURIComponent(id)}`, { headers })

Type guard

const isNonEmptyString = (v: unknown): v is string =>
  typeof v === 'string' && v.trim().length > 0

Prevention

When it happens

Trigger: GET /api/v1/assistants/ (no id segment). Client fetching by an empty id variable so the URL collapses to the root. (Note: GET /api/v1/assistants with no trailing slash is handled by getAllAssistants, a different handler.)

Common situations: Detail-view fetch fired before an assistant id is known; routing bug that drops the id; test calling the collection root expecting a single resource.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/ba26e5419453451c. Report an issue: GitHub.