mudler/LocalAI · warning · Error

Backend is required

Error message

Backend is required

What it means

Thrown by validateConfig() when config.name is present but config.backend is missing AND the config is not a pipeline config. A pipeline config is detected by config.pipeline having any of vad, transcription, tts, or llm sub-keys; pipelines route through their components so no single backend is required.

Source

Thrown at core/http/views/model-editor.html:1073

#   - 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();
                const config = jsyaml.load(yamlContent);
                
                if (!config || typeof config !== 'object') {
                    throw new Error('Invalid YAML structure');

View on GitHub (pinned to 44413a9d06)

Solutions

  1. Add 'backend: <backend-name>' (e.g. llama.cpp, transformers) for non-pipeline models
  2. If you meant a pipeline, verify 'pipeline:' is a top-level key with vad/transcription/tts/llm entries
  3. Check for indentation that accidentally nested backend under another key

Example fix

# before
name: my-model
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 isPipelineConfig(config) {
  const p = config && config.pipeline
  return !!p && !!(p.vad || p.transcription || p.tts || p.llm)
}

function hasBackendOrPipeline(config) {
  return isModelMapping(config) && (isPipelineConfig(config) || typeof config.backend === 'string')
}

Type guard

function isPipelineConfig(config) {
  const p = config && config.pipeline
  return !!p && !!(p.vad || p.transcription || p.tts || p.llm)
}

Try / catch

try {
  if (!hasBackendOrPipeline(config)) throw new Error('Backend is required')
} catch (error) {
  this.showAlert('error', 'Validation failed: ' + error.message)
}

Prevention

When it happens

Trigger: A plain model config with name and parameters.model but no 'backend:' key; or intending a pipeline but the pipeline block is misspelled/misstructured so isPipeline is false.

Common situations: Commenting out backend while experimenting; typo 'pipeline:' nested under parameters so the top-level check misses it; using a backend alias format the check does not recognize (the check is presence-only, so this is rare).

Related errors


AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15). Data as JSON: /api/errors/c6d613692f830187. Report an issue: GitHub.