FlowiseAI/Flowise · warning · InternalFlowiseError

Error: assistantsController.updateAssistant - id not provide

Error message

Error: assistantsController.updateAssistant - id not provided!

What it means

Thrown by updateAssistant with HTTP 412 when req.params is undefined or req.params.id is falsy. Mounted via routes/assistants/index.ts:15 as PUT ['/', '/:id'], so PUT /api/v1/assistants/ (root) reaches updateAssistant with no id. This is the first of three sequential guards in updateAssistant (id, then body, then workspace).

Source

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

        }
        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)
    }
}

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

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Call PUT /api/v1/assistants/<id> with the resource id to update.
  2. Guard id is a non-empty string before issuing the PUT.

Example fix

// before
await fetch(`${BASE}/api/v1/assistants/`, { method: 'PUT', headers, body: JSON.stringify(payload) })

// after
if (!assistantId) throw new Error('assistant id required')
await fetch(`${BASE}/api/v1/assistants/${encodeURIComponent(assistantId)}`, { method: 'PUT', headers, body: JSON.stringify(payload) })
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 to update')
  }
  return id
}
const id = assertId(selectedId)
await fetch(`${BASE}/api/v1/assistants/${encodeURIComponent(id)}`, { method: 'PUT', headers, body: JSON.stringify(payload) })

Type guard

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

Prevention

When it happens

Trigger: PUT /api/v1/assistants/ (no id segment) — e.g. a save action with no resource id, or a client PUT to the collection root.

Common situations: Create-vs-update ambiguity in the client (PUT to root intending create); id variable empty when the edit form had no loaded resource.

Related errors


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