FlowiseAI/Flowise · warning · InternalFlowiseError

Error: credentialsController.updateCredential - id not provi

Error message

Error: credentialsController.updateCredential - id not provided!

What it means

Thrown by updateCredential when req.params.id is missing or empty. This is the first guard in the handler, checked before the body and workspace guards. Returns HTTP 412 PRECONDITION_FAILED.

Source

Thrown at packages/server/src/controllers/credentials/index.ts:108

        }
        const workspaceId = req.user?.activeWorkspaceId
        if (!workspaceId) {
            throw new InternalFlowiseError(
                StatusCodes.NOT_FOUND,
                `Error: credentialsController.revealCredentialById - workspace ${workspaceId} not found!`
            )
        }
        const apiResponse = await credentialsService.revealCredentialById(req.params.id, workspaceId)
        return res.json(apiResponse)
    } catch (error) {
        next(error)
    }
}

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

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Check the outgoing PUT URL has a UUID id segment.
  2. Disable the Save/Update button in the UI until a credential with a non-empty id is selected.
  3. Validate id is a non-empty string before constructing the request.
  4. Confirm route registration includes :id (e.g. app.put('/credentials/:id', ...)).

Example fix

// before
await api.updateCredential(editingId, payload) // editingId may be undefined

// after
if (typeof editingId !== 'string' || editingId.length === 0) {
  throw new Error('Cannot update: no credential id')
}
await api.updateCredential(editingId, payload)
Defensive patterns

Strategy: type-guard

Validate before calling

function requireCredentialId(id: unknown): string {
  if (typeof id !== 'string' || id.trim().length === 0) {
    throw new Error('credential id required to update')
  }
  return id
}

const id = requireCredentialId(editingId)
await api.updateCredential(id, payload)

Type guard

function isNonEmptyString(v: unknown): v is string {
  return typeof v === 'string' && v.length > 0
}

Try / catch

try {
  await api.updateCredential(id, payload)
} catch (e) {
  if (e.status === 412 && /id not provided/.test(e.message)) {
    // caller bug — do not retry
    console.error('update called without an id')
    return
  }
  throw e
}

Prevention

When it happens

Trigger: PUT/PATCH /api/v1/credentials/ (no id) or /api/v1/credentials/undefined when updating a credential. The frontend typically builds the URL from a row's id that is null on first render.

Common situations: Edit form submitted before a credential row is selected. URL built from a destructured prop that is undefined. Route mis-registered without :id.

Related errors


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