mudler/LocalAI · warning · Error
Model name is required
Error message
Model name is required
What it means
Thrown by validateConfig() when the parsed YAML mapping has no name key (or name is empty/null). The model name is the identifier LocalAI uses for the config file and API references, so validation stops before checking backend and parameters.model.
Source
Thrown at core/http/views/model-editor.html:1069
# Use cases
# known_usecases:
# - chat
# - completion
`;
},
validateConfig() {
try {
const yamlContent = this.yamlEditor.getValue();
const config = jsyaml.load(yamlContent);
if (!config || typeof config !== 'object') {
throw new Error('Invalid YAML structure');
}
if (!config.name) {
throw new Error('Model name is required');
}
const isPipeline = config.pipeline && (config.pipeline.vad || config.pipeline.transcription || config.pipeline.tts || config.pipeline.llm);
if (!isPipeline && !config.backend) {
throw new Error('Backend is required');
}
if (!isPipeline && (!config.parameters || !config.parameters.model)) {
throw new Error('Model file/path is required in parameters.model');
}
this.showAlert('success', 'Configuration is valid!');
} catch (error) {
this.showAlert('error', 'Validation failed: ' + error.message);
}
},
async saveConfig() {
try {
const yamlContent = this.yamlEditor.getValue();View on GitHub (pinned to 44413a9d06)
Solutions
- Add a top-level 'name: <unique-model-id>' line
- Ensure name is not nested under another key due to indentation
- Pick a name unique among installed models to avoid collisions on save
Example fix
# before backend: llama.cpp parameters: model: /models/foo.gguf # after name: my-model backend: llama.cpp parameters: model: /models/foo.gguf
Defensive patterns
Strategy: validation
Validate before calling
function hasModelName(config) {
return isModelMapping(config) && typeof config.name === 'string' && config.name.trim().length > 0
} Type guard
function hasModelName(config) {
return isModelMapping(config) && typeof config.name === 'string' && config.name.trim().length > 0
} Try / catch
try {
if (!hasModelName(config)) throw new Error('Model name is required')
} catch (error) {
this.showAlert('error', 'Validation failed: ' + error.message)
} Prevention
- Keep 'name:' as the first line of every model config
- Give the name a unique slug matching installed models' naming to avoid collisions
- Watch indentation — a nested name silently fails this check
When it happens
Trigger: A config like 'backend: llama.cpp\nparameters:\n model: foo.gguf' with no 'name:' line, or 'name:' with an empty value.
Common situations: Copying a fragment of a model config without its header; renaming by deleting the name line; YAML indentation putting name under another key.
Related errors
- Invalid YAML structure
- Backend is required
- Model file/path is required in parameters.model
- HTTP ${response.status}
- HTTP ${response.status}
AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15).
Data as JSON: /api/errors/e023b3329ca09cc1.
Report an issue: GitHub.