{"record":{"id":"dde3bee037515c7b","repo":"FlowiseAI/Flowise","slug":"model-name-is-required-please-enter-a-valid-model","errorCode":null,"errorMessage":"Model Name is required. Please enter a valid model name (e.g., gpt-5-mini, claude-sonnet-4-20250514).","messagePattern":"Model Name is required\\. Please enter a valid model name \\(e\\.g\\., gpt-5-mini, claude-sonnet-4-20250514\\)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/chatmodels/ChatCometAPI/ChatCometAPI.ts","lineNumber":132,"sourceCode":"        const streaming = nodeData.inputs?.streaming as boolean\n        const baseOptions = nodeData.inputs?.baseOptions\n\n        if (nodeData.inputs?.credentialId) {\n            nodeData.credential = nodeData.inputs?.credentialId\n        }\n        const credentialData = await getCredentialData(nodeData.credential ?? '', options)\n        const openAIApiKey = getCredentialParam('cometApiKey', credentialData, nodeData)\n\n        // Custom error handling for missing API key\n        if (!openAIApiKey || openAIApiKey.trim() === '') {\n            throw new Error(\n                'CometAPI API Key is missing or empty. Please provide a valid CometAPI API key in the credential configuration.'\n            )\n        }\n\n        // Custom error handling for missing model name\n        if (!modelName || modelName.trim() === '') {\n            throw new Error('Model Name is required. Please enter a valid model name (e.g., gpt-5-mini, claude-sonnet-4-20250514).')\n        }\n\n        const cache = nodeData.inputs?.cache as BaseCache\n\n        const obj: ChatOpenAIFields = {\n            temperature: parseFloat(temperature),\n            modelName,\n            openAIApiKey,\n            apiKey: openAIApiKey,\n            streaming: streaming ?? true\n        }\n\n        if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)\n        if (topP) obj.topP = parseFloat(topP)\n        if (frequencyPenalty) obj.frequencyPenalty = parseFloat(frequencyPenalty)\n        if (presencePenalty) obj.presencePenalty = parseFloat(presencePenalty)\n        if (cache) obj.cache = cache\n","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/chatmodels/ChatCometAPI/ChatCometAPI.ts#L114-L150","documentation":"Thrown by ChatCometAPI.init() (line 132) when modelName (nodeData.inputs.modelName) is falsy or trims to empty. It runs immediately after the API-key guard, so a valid key must already be present. CometAPI is an OpenAI-compatible gateway that requires an explicit model identifier (e.g., gpt-5-mini, claude-sonnet-4-20250514) because it routes across many upstream providers.","triggerScenarios":"init() is called with nodeData.inputs.modelName undefined, empty, or whitespace-only after the cometApiKey check has passed.","commonSituations":"The model dropdown/field was left unselected in the Flowise UI, the model name was cleared, or a chatflow template was imported without the modelName input.","solutions":["In the ChatCometAPI node, set the Model Name input to a valid CometAPI-supported model identifier (e.g., gpt-5-mini).","If set dynamically via variable, ensure the upstream node actually emits a non-empty string value.","Avoid leading/trailing spaces when typing the model name manually."],"exampleFix":"// before: nodeData.inputs.modelName = undefined\n// after:  nodeData.inputs.modelName = \"gpt-5-mini\"","handlingStrategy":"validation","validationCode":"function hasModelName(nodeData: INodeData): boolean {\n  const m = nodeData.inputs?.modelName\n  return typeof m === 'string' && m.trim() !== ''\n}\nif (!hasModelName(nodeData)) throw new Error('ChatCometAPI requires a non-empty modelName input')","typeGuard":"function nodeHasModelName(nodeData: unknown): nodeData is { inputs: { modelName: string } } {\n  return typeof nodeData === 'object' && nodeData !== null\n    && typeof (nodeData as any).inputs?.modelName === 'string'\n    && (nodeData as any).inputs.modelName.trim() !== ''\n}","tryCatchPattern":"try {\n  await chatCometAPI.init(nodeData, '', options)\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Model Name is required')) {\n    // mark the Model Name field invalid in the UI\n  }\n  throw e\n}","preventionTips":["Default the Model Name input to a known-good CometAPI model id.","When binding modelName from a variable, validate it before the chatflow runs.","Document the list of supported model ids in the node's param description."],"tags":["configuration","cometapi","validation","model-selection"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}