FlowiseAI/Flowise · warning · InternalFlowiseError
Error: credentialsController.getCredentialById - id not prov
Error message
Error: credentialsController.getCredentialById - id not provided!
What it means
Thrown by getCredentialById when req.params.id is undefined or empty. The guard uses typeof req.params === 'undefined' || !req.params.id, so it fires for a missing :id route param, an empty string, or a literal 'undefined'. This is a client-side URL construction bug, not an auth or DB issue. Returns HTTP 412 PRECONDITION_FAILED.
Source
Thrown at packages/server/src/controllers/credentials/index.ts:64
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!`
)
}
const workspaceId = req.user?.activeWorkspaceId
if (!workspaceId) {
throw new InternalFlowiseError(
StatusCodes.NOT_FOUND,
`Error: credentialsController.getCredentialById - workspace ${workspaceId} not found!`
)
}
const apiResponse = await credentialsService.getCredentialById(req.params.id, workspaceId)
return res.json(apiResponse)
} catch (error) {
next(error)
}
}
View on GitHub (pinned to abe4a8601a)
Solutions
- Inspect the outgoing request URL in the browser network tab and confirm the id segment is a real UUID.
- On the client, guard the fetch: only call getCredentialById when typeof id === 'string' && id.length > 0.
- If using react-query/sWR, enable the query only when id is truthy (enabled: !!id).
- Verify the route is registered with the :id param (app.get('/credentials/:id', ...)) and not accidentally mounted as '/credentials/').
Example fix
// before
const res = await fetch(`/api/v1/credentials/${id}`) // id may be undefined
// after
if (!id) throw new Error('credential id required')
const res = await fetch(`/api/v1/credentials/${encodeURIComponent(id)}`) 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 is required')
}
return id
}
const id = requireCredentialId(params.id)
await api.getCredentialById(id) Type guard
function isNonEmptyString(v: unknown): v is string {
return typeof v === 'string' && v.length > 0
} Try / catch
try {
await api.getCredentialById(id)
} catch (e) {
if (e.status === 412 && /id not provided/.test(e.message)) {
// programming error — do not retry; fix the caller
console.error('caller passed an empty credential id')
}
throw e
} Prevention
- Build URL templates like `/credentials/${encodeURIComponent(id)}` only after a non-empty id check.
- For react-query / SWR, set `enabled: !!id` so the request waits for a real id.
- Never stringify undefined/null into a URL path — guard first.
When it happens
Trigger: GET /api/v1/credentials/ (trailing slash, no id). GET /api/v1/credentials/undefined or /api/v1/credentials/null from a frontend that stringified an undefined variable into the path. Route mis-mounted so :id never parses.
Common situations: Frontend template like `/credentials/${selected?.id}` where selected is null on first render. Copy-paste of an API path that drops the id segment. Client building URLs from a form field the user left blank.
Related errors
- Error: credentialsController.revealCredentialById - id not p
- Error: credentialsController.updateCredential - id not provi
- Error: credentialsController.updateCredential - body not pro
- Error: credentialsController.createCredential - body not pro
- Error: credentialsController.deleteCredentials - id not prov
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/db2752dd1154a733.
Report an issue: GitHub.