{"record":{"id":"a110f3382c8cafaf","repo":"FlowiseAI/Flowise","slug":"error-componentscredentialscontroller-getcomponen","errorCode":null,"errorMessage":"Error: componentsCredentialsController.getComponentByName - name not provided!","messagePattern":"Error: componentsCredentialsController\\.getComponentByName - name not provided!","errorType":"exception","errorClass":"InternalFlowiseError","httpStatus":412,"severity":"error","filePath":"packages/server/src/controllers/components-credentials/index.ts","lineNumber":20,"sourceCode":"import componentsCredentialsService from '../../services/components-credentials'\nimport { InternalFlowiseError } from '../../errors/internalFlowiseError'\nimport { StatusCodes } from 'http-status-codes'\n\n// Get all component credentials\nconst getAllComponentsCredentials = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        const apiResponse = await componentsCredentialsService.getAllComponentsCredentials()\n        return res.json(apiResponse)\n    } catch (error) {\n        next(error)\n    }\n}\n\n// Get component credential via name\nconst getComponentByName = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        if (typeof req.params === 'undefined' || !req.params.name) {\n            throw new InternalFlowiseError(\n                StatusCodes.PRECONDITION_FAILED,\n                `Error: componentsCredentialsController.getComponentByName - name not provided!`\n            )\n        }\n        const apiResponse = await componentsCredentialsService.getComponentByName(req.params.name)\n        return res.json(apiResponse)\n    } catch (error) {\n        next(error)\n    }\n}\n\n// Returns specific component credential icon via name\nconst getSingleComponentsCredentialIcon = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        if (typeof req.params === 'undefined' || !req.params.name) {\n            throw new InternalFlowiseError(\n                StatusCodes.PRECONDITION_FAILED,\n                `Error: componentsCredentialsController.getSingleComponentsCredentialIcon - name not provided!`","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/server/src/controllers/components-credentials/index.ts#L2-L38","documentation":"Thrown by componentsCredentialsController.getComponentByName when req.params.name is missing. The endpoint returns a single component-credential definition identified by name, so the name is mandatory. Returned as PRECONDITION_FAILED (412).","triggerScenarios":"GET to the component-by-name route with no :name segment, or a route declaration missing :name so the param resolves undefined.","commonSituations":"Catalog UI requesting a component before selection, URL built from an undefined name, or a renamed component whose old link no longer carries a name.","solutions":["Include the component name in the path.","Guard the fetch on a selected component name on the client.","Confirm the route declares :name."],"exampleFix":"// before\nfetch(`/api/v1/components-credentials/`)\n// after\nfetch(`/api/v1/components-credentials/${encodeURIComponent(name)}`)","handlingStrategy":"validation","validationCode":"function getComponentByName(name: string) {\n  if (!name) throw new Error('component name required')\n  return fetch(`/api/v1/components-credentials/${encodeURIComponent(name)}`)\n}","typeGuard":"const isNonEmptyString = (v: unknown): v is string => typeof v === 'string' && v.trim().length > 0","tryCatchPattern":"try { await getComponentByName(name) } catch (e) { if (e.statusCode === 412) throw new Error('provide a component name') }","preventionTips":["Fetch a component only after a name is selected.","Validate name presence client-side.","Confirm the route declares :name."],"tags":["flowise","controller","validation","precondition-failed","path-param","components","typescript"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}