FlowiseAI/Flowise · error · Error

Model Name is required. Please enter a valid model name (e.g

Error message

Model Name is required. Please enter a valid model name (e.g., gpt-5-mini, claude-sonnet-4-20250514).

What it means

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.

Source

Thrown at packages/components/nodes/chatmodels/ChatCometAPI/ChatCometAPI.ts:132

        const streaming = nodeData.inputs?.streaming as boolean
        const baseOptions = nodeData.inputs?.baseOptions

        if (nodeData.inputs?.credentialId) {
            nodeData.credential = nodeData.inputs?.credentialId
        }
        const credentialData = await getCredentialData(nodeData.credential ?? '', options)
        const openAIApiKey = getCredentialParam('cometApiKey', credentialData, nodeData)

        // Custom error handling for missing API key
        if (!openAIApiKey || openAIApiKey.trim() === '') {
            throw new Error(
                'CometAPI API Key is missing or empty. Please provide a valid CometAPI API key in the credential configuration.'
            )
        }

        // Custom error handling for missing model name
        if (!modelName || modelName.trim() === '') {
            throw new Error('Model Name is required. Please enter a valid model name (e.g., gpt-5-mini, claude-sonnet-4-20250514).')
        }

        const cache = nodeData.inputs?.cache as BaseCache

        const obj: ChatOpenAIFields = {
            temperature: parseFloat(temperature),
            modelName,
            openAIApiKey,
            apiKey: openAIApiKey,
            streaming: streaming ?? true
        }

        if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)
        if (topP) obj.topP = parseFloat(topP)
        if (frequencyPenalty) obj.frequencyPenalty = parseFloat(frequencyPenalty)
        if (presencePenalty) obj.presencePenalty = parseFloat(presencePenalty)
        if (cache) obj.cache = cache

View on GitHub (pinned to abe4a8601a)

Solutions

  1. In the ChatCometAPI node, set the Model Name input to a valid CometAPI-supported model identifier (e.g., gpt-5-mini).
  2. If set dynamically via variable, ensure the upstream node actually emits a non-empty string value.
  3. Avoid leading/trailing spaces when typing the model name manually.

Example fix

// before: nodeData.inputs.modelName = undefined
// after:  nodeData.inputs.modelName = "gpt-5-mini"
Defensive patterns

Strategy: validation

Validate before calling

function hasModelName(nodeData: INodeData): boolean {
  const m = nodeData.inputs?.modelName
  return typeof m === 'string' && m.trim() !== ''
}
if (!hasModelName(nodeData)) throw new Error('ChatCometAPI requires a non-empty modelName input')

Type guard

function nodeHasModelName(nodeData: unknown): nodeData is { inputs: { modelName: string } } {
  return typeof nodeData === 'object' && nodeData !== null
    && typeof (nodeData as any).inputs?.modelName === 'string'
    && (nodeData as any).inputs.modelName.trim() !== ''
}

Try / catch

try {
  await chatCometAPI.init(nodeData, '', options)
} catch (e) {
  if (e instanceof Error && e.message.startsWith('Model Name is required')) {
    // mark the Model Name field invalid in the UI
  }
  throw e
}

Prevention

When it happens

Trigger: init() is called with nodeData.inputs.modelName undefined, empty, or whitespace-only after the cometApiKey check has passed.

Common situations: 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.

Related errors


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