{"record":{"id":"c6d613692f830187","repo":"mudler/LocalAI","slug":"backend-is-required","errorCode":null,"errorMessage":"Backend is required","messagePattern":"Backend is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"core/http/views/model-editor.html","lineNumber":1073,"sourceCode":"#   - completion\n`;\n        },\n        \n        validateConfig() {\n            try {\n                const yamlContent = this.yamlEditor.getValue();\n                const config = jsyaml.load(yamlContent);\n                \n                if (!config || typeof config !== 'object') {\n                    throw new Error('Invalid YAML structure');\n                }\n                \n                if (!config.name) {\n                    throw new Error('Model name is required');\n                }\n                const isPipeline = config.pipeline && (config.pipeline.vad || config.pipeline.transcription || config.pipeline.tts || config.pipeline.llm);\n                if (!isPipeline && !config.backend) {\n                    throw new Error('Backend is required');\n                }\n                if (!isPipeline && (!config.parameters || !config.parameters.model)) {\n                    throw new Error('Model file/path is required in parameters.model');\n                }\n                \n                this.showAlert('success', 'Configuration is valid!');\n            } catch (error) {\n                this.showAlert('error', 'Validation failed: ' + error.message);\n            }\n        },\n        \n        async saveConfig() {\n            try {\n                const yamlContent = this.yamlEditor.getValue();\n                const config = jsyaml.load(yamlContent);\n                \n                if (!config || typeof config !== 'object') {\n                    throw new Error('Invalid YAML structure');","sourceCodeStart":1055,"sourceCodeEnd":1091,"githubUrl":"https://github.com/mudler/LocalAI/blob/44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26/core/http/views/model-editor.html#L1055-L1091","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Add 'backend: <backend-name>' (e.g. llama.cpp, transformers) for non-pipeline models","If you meant a pipeline, verify 'pipeline:' is a top-level key with vad/transcription/tts/llm entries","Check for indentation that accidentally nested backend under another key"],"exampleFix":"# before\nname: my-model\nparameters:\n  model: /models/foo.gguf\n\n# after\nname: my-model\nbackend: llama.cpp\nparameters:\n  model: /models/foo.gguf","handlingStrategy":"validation","validationCode":"function isPipelineConfig(config) {\n  const p = config && config.pipeline\n  return !!p && !!(p.vad || p.transcription || p.tts || p.llm)\n}\n\nfunction hasBackendOrPipeline(config) {\n  return isModelMapping(config) && (isPipelineConfig(config) || typeof config.backend === 'string')\n}","typeGuard":"function isPipelineConfig(config) {\n  const p = config && config.pipeline\n  return !!p && !!(p.vad || p.transcription || p.tts || p.llm)\n}","tryCatchPattern":"try {\n  if (!hasBackendOrPipeline(config)) throw new Error('Backend is required')\n} catch (error) {\n  this.showAlert('error', 'Validation failed: ' + error.message)\n}","preventionTips":["Set backend before anything else when drafting a non-pipeline model","For pipelines, double-check the pipeline block spelling and placement — the exemption keys off exact sub-keys","Confirm the backend id matches one LocalAI actually ships"],"tags":["yaml","validation","legacy-ui","model-config"],"backgroundTag":null,"analyzedSha":"44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26","analyzedAt":"2026-08-15T10:13:50.291Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}